Skip to content

Commit

Permalink
fix: updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-tihon committed Mar 21, 2024
1 parent 1c02756 commit 1b0eea7
Showing 1 changed file with 40 additions and 15 deletions.
55 changes: 40 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,54 @@
[![Build Status](https://github.com/sergey-tihon/Stanford.NLP.NET/workflows/Build%20and%20Test/badge.svg?branch=master)](https://github.com/sergey-tihon/Stanford.NLP.NET/actions?query=branch%3Amaster)

Stanford.NLP for .NET
=====================

`Stanford.NLP for .NET` is a port of Stanford NLP distributions to .NET.
> 2024-03-21: All [Stanford.NLP NuGet packages](https://www.nuget.org/packages?q=Stanford.NLP) are marted as deprecated (legacy and no longer maintained). Please use [official Stanford CoreNLP Maven package](https://mvnrepository.com/artifact/edu.stanford.nlp/stanford-corenlp) instead with [IKVM.Maven.Sdk](https://github.com/ikvmnet/ikvm-maven).

Getting started `IKVM.Maven.Sdk`
---------------------------

Copy following lines into your project file:

```xml
<ItemGroup>
<PackageReference Include="IKVM" Version="8.7.5" />
<PackageReference Include="IKVM.Maven.Sdk" Version="1.6.8" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<MavenReference Include="edu.stanford.nlp:stanford-corenlp" Version="4.5.6"/>
<MavenReference Include="edu.stanford.nlp:stanford-corenlp" Version="4.5.6" Classifier="models" />
</ItemGroup>
```
First two `PackageReference`es add [IKVM](https://github.com/ikvmnet/ikvm) and [IKVM.Maven.Sdk](https://github.com/ikvmnet/ikvm-maven) to your project. The `MavenReference`es are used to download and compile Stanford CoreNLP `.jar` files and models.

The next step is to manually load the assembly with models into you process

This project contains build scripts that recompile Stanford NLP `.jar` packages to .NET assemblies using [IKVM.NET](http://www.ikvm.net/), tests that help to be sure that recompiled packages are workable and [Stanford.NLP for .NET documentation site](http://sergey-tihon.github.io/Stanford.NLP.NET/) that hosts samples for all packages. All recompiled packages are available on [NuGet](https://www.nuget.org/packages?q=Stanford.NLP).
```csharp
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
var modelsAssemblyPath = Path.Combine(baseDirectory, "edu.stanford.nlp.corenlp_english_models.dll");
Assembly.LoadFile(modelsAssemblyPath);
```

### Master package
[Previously](http://sergey-tihon.github.io/Stanford.NLP.NET/#/FAQ#stanfordnlpcorenlp-not-loading-models) you have to manually find `*.jar` file with models, unpack it and temporary change the current directory to the unpacked folder. This is no longer needed with `IKVM.Maven.Sdk`. The `*.jar` with models is automatically downloaded and compiled to `*.dll` with the same name. The only thing that you have to do it to load this assembly into your process.

- [![NuGet Badge](https://buildstats.info/nuget/Stanford.NLP.CoreNLP)](https://www.nuget.org/packages/Stanford.NLP.CoreNLP/) - **Stanford.NLP.CoreNLP**
You are ready to use Stanford CoreNLP in your .NET project.

### Other packages
```csharp
var text = "Kosgi Santosh sent an email to Stanford University. He didn't get a reply.";

- [![NuGet Badge](https://buildstats.info/nuget/Stanford.NLP.NER)](https://www.nuget.org/packages/Stanford.NLP.NER/) - **Stanford.NLP.NER**
- [![NuGet Badge](https://buildstats.info/nuget/Stanford.NLP.Parser)](https://www.nuget.org/packages/Stanford.NLP.Parser/) - **Stanford.NLP.Parser**
- [![NuGet Badge](https://buildstats.info/nuget/Stanford.NLP.POSTagger)](https://www.nuget.org/packages/Stanford.NLP.POSTagger/) - **Stanford.NLP.POSTagger**
- [![NuGet Badge](https://buildstats.info/nuget/Stanford.NLP.Segmenter)](https://www.nuget.org/packages/Stanford.NLP.Segmenter/) - **Stanford.NLP.Segmenter**
// Annotation pipeline configuration
var props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse");
props.setProperty("ner.useSUTime", "false");

var pipeline = new StanfordCoreNLP(props);

Versioning
----------
// Annotation
var annotation = new Annotation(text);
pipeline.annotate(annotation);
```

Versioning model used for NuGet packages is aligned to versioning used by Stanford NLP Group.
For example, if you get `Stanford CoreNLP` distribution from [Stanford NLP site](http://www-nlp.stanford.edu/software/index.shtml) with version `3.3.1`, then the NuGet version of this package has a version `3.3.1.x`, where `x` is the greatest that is available on NuGet. Last number is used for internal versioning of .NET assemblies.
P.S. More samples are available in the [Stanford.NLP.NET](http://sergey-tihon.github.io/Stanford.NLP.NET) repository.

Licensing of the code/content of this repo
---------------------------
Expand Down

0 comments on commit 1b0eea7

Please sign in to comment.