0
votes

I have a c# code (though copied) im getting error at this statement ->var pipeline = new StanfordCoreNLP(props); (An unhandled exception of type 'java.lang.RuntimeException' occurred in stanford-corenlp-3.7.0.dll

Additional information: edu.stanford.nlp.io.RuntimeIOException: Error while loading a tagger model (probably missing model file))

my models n core nlp are of same version stanford-corenlp-3.7.0-models.jar stanford-corenlp-3.7.0.jar

any help wold be greatly appreciated !!

1
You say you have C# code, but your errors are Java exceptions... If you think you're writing C# but you're actually doing Java development you might have bigger problems than you think. - Matt Hogan-Jones

1 Answers

0
votes

Many sources advised to extract 'stanford-corenlp-full-2017-06-09'(link) folder and add extracted 'stanford-corenlp-3.8.0-models.jar' to the project.

I tried many methods, to change its properties 'Build Action to Content and the Copy to Output Directory setting to Copy if newer', but couldn't find a solution to perform the same for multiple files in inner folders.

So, What I did is :

Extracted 'stanford-corenlp-3.8.0-models.jar' and copied it to 'bin/debug'. And my code is as follows:

var jarRoot = @"stanford-corenlp-3.8.0-models\";
var props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, parse, sentiment");
props.setProperty("sutime.binders", "0");
var curDir = Environment.CurrentDirectory;
var modelsDirectory = curDir + "\\" + jarRoot + @"\edu\stanford\nlp\models";
Directory.SetCurrentDirectory(jarRoot);

// Loading POS Tagger
var tagger = new MaxentTagger(modelsDirectory + @"\pos-tagger\english-left3words\english-left3words-distsim.tagger");

var pipeline = new StanfordCoreNLP(props);

Its working fine for me with this settings and code.

Note: The version changes should be made. Also in production environment, it should be handled differently(and I dont know how!!!).