sergey-tihon / Stanford.NLP.NET

Stanford NLP for .NET
http://sergey-tihon.github.io/Stanford.NLP.NET/
MIT License
595 stars 123 forks source link

c# issues #100

Closed tariqnahmad closed 5 years ago

tariqnahmad commented 5 years ago

hi,

not really sure how to get this stuff working? ive downloaded various things (not sure what the difference is) :

  1. CoreNLP from NuGet
  2. http://sergey-tihon.github.io/Stanford.NLP.NET/StanfordCoreNLP.html
  3. something else i forget

and now I have folders:

stanford-corenlp-full-2016-10-31 stanford-corenlp-full-2018-10-05 stanford-english-corenlp-2018-10-05-models

Q1: do i need to unzip ALL the jar files in these folders? I have unzipped some but it seems a bit hit and miss?

When I follow the c# code on this page http://sergey-tihon.github.io/Stanford.NLP.NET/StanfordCoreNLP.html I get an error on the line Dim pipeline = New StanfordCoreNLP(props):

edu.stanford.nlp.io.RuntimeIOException: 'Couldn't read TokensRegexNER from edu/stanford/nlp/models/kbp/english/gazetteers/regexner_caseless.tab'

IOException: Unable to open "edu/stanford/nlp/models/kbp/english/gazetteers/regexner_caseless.tab" as class path, filename or URL

Yes I know those files are missing - but why?

sergey-tihon commented 5 years ago

stanford-corenlp-full-2018-10-05 should work with latest NuGet.

the easiest way to ensure that you unzip it right is to check that isOk == true

Directory.SetCurrentDirectory(jarRoot);
var isOK = File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "edu/stanford/nlp/models/kbp/english/gazetteers/regexner_caseless.tab"));
Debug.Assert(isOK);  
var pipeline = StanfordCoreNLP(props);

if it is false then your jarRoot path is incorrect

tariqnahmad commented 5 years ago

My stanford-corenlp-full-2018-10-05 folder contains 3 folders "patterns", "sutime" and "tokensregex". It also contains tons of .jar files and various other bits and bats.

No sign of a folder called "edu"?

sergey-tihon commented 5 years ago

It is inside jar with models, stanford-corenlp-3.9.2-models.jar. Rename this file to .zip and unzip.

tariqnahmad commented 5 years ago

OK, so you must be referring to stanford-corenlp-3.9.2-models.jar. Thats fine I'll try that.

But herein lies my issue, wheres the instructions telling us to do that? And do I need to unzip all the .jar files or just seemingly random ones?

sergey-tihon commented 5 years ago

In the getting started section on landing page Stanford_NLP_Software_for__NET and in FAQ section - https://sergey-tihon.github.io/Stanford.NLP.NET//faq.html#Stanford-NLP-CoreNLP-not-loading-models

it may be not clear, but Stanford NLP group distribute models differently with different tools

tariqnahmad commented 5 years ago

perfect. thanks.