0

I would like to analyze sentences (others languages to english) with Stabnford NLP.

For the moment I run the server on localhost:9000 with

java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer

And in my node server I call the api like this :

output=$(wget --post-data '+"'"+text+"' "+"'localhost:"+port+'
/?properties=
{
    "props": "StanfordCoreNLP-[OTHER LANGUAGE].properties", 
    "annotators": "ssplit,parse", 
    "outputFormat": "json"
}' 
-qO -) && echo $output",{ encoding: 'utf8' }

However the result is still for english language, I don't don't why ? Anyone have an idea to use others language on stanford NLP ?

Thanks

onedkr
  • 3,226
  • 3
  • 21
  • 31

2 Answers2

2

You should use this option with your request (example: german):

"pipelineLanguage":"german"
StanfordNLPHelp
  • 8,699
  • 1
  • 11
  • 9
0

Thank's for your answer. However, when I add this option with the language "french" for example, the command wget fail.

I downloaded stanford-corenlp-full where I included stanford-french-corenlp-models-current.jar. When you see the log of stanford NLP I have the impression that NLP try to load english language.

How can I fix it ? Here above my log :

[main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator tokenize
    [main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ssplit
    [main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator pos
    [main] INFO edu.stanford.nlp.tagger.maxent.MaxentTagger - Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [4,6 sec].
    [main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator lemma
    [main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ner
    [main] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [8,0 sec].
    [main] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz ... done [5,1 sec].
    [main] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz ... done [3,2 sec].
    [main] INFO edu.stanford.nlp.time.JollyDayHolidays - Initializing JollyDayHoliday for SUTime from classpath edu/stanford/nlp/models/sutime/jollyday/Holidays_sutime.xml as sutime.binder.1.
    [main] INFO edu.stanford.nlp.ling.tokensregex.CoreMapExpressionExtractor - Reading TokensRegex rules from edu/stanford/nlp/models/sutime/defs.sutime.txt
    [main] INFO edu.stanford.nlp.ling.tokensregex.CoreMapExpressionExtractor - Read 83 rules
    [main] INFO edu.stanford.nlp.ling.tokensregex.CoreMapExpressionExtractor - Reading TokensRegex rules from edu/stanford/nlp/models/sutime/english.sutime.txt
    [main] INFO edu.stanford.nlp.ling.tokensregex.CoreMapExpressionExtractor - Read 267 rules
    [main] INFO edu.stanford.nlp.ling.tokensregex.CoreMapExpressionExtractor - Reading TokensRegex rules from edu/stanford/nlp/models/sutime/english.holidays.sutime.txt
    [main] INFO edu.stanford.nlp.ling.tokensregex.CoreMapExpressionExtractor - Read 25 rules
    [main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator depparse
    [main] INFO edu.stanford.nlp.parser.nndep.DependencyParser - Loading depparse model file: edu/stanford/nlp/models/parser/nndep/english_UD.gz ...
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
            at edu.stanford.nlp.parser.nndep.Classifier.preCompute(Classifier.java:661)
            at edu.stanford.nlp.parser.nndep.Classifier.preCompute(Classifier.java:643)
            at edu.stanford.nlp.parser.nndep.DependencyParser.initialize(DependencyParser.java:1168)
            at edu.stanford.nlp.parser.nndep.DependencyParser.loadModelFile(DependencyParser.java:605)
            at edu.stanford.nlp.parser.nndep.DependencyParser.loadFromModelFile(DependencyParser.java:498)
            at edu.stanford.nlp.pipeline.DependencyParseAnnotator.<init>(DependencyParseAnnotator.java:57)
            at edu.stanford.nlp.pipeline.AnnotatorImplementations.dependencies(AnnotatorImplementations.java:273)
            at edu.stanford.nlp.pipeline.AnnotatorFactories$18.create(AnnotatorFactories.java:478)
            at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:152)
            at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:451)
            at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:154)
            at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:150)
            at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:137)
            at edu.stanford.nlp.pipeline.StanfordCoreNLP.main(StanfordCoreNLP.java:1326)

PS: The error occurs when I run the wget.

onedkr
  • 3,226
  • 3
  • 21
  • 31