2014-11-02 75 views
3

我想使用這個命令在一個文件中使用斯坦福NLP情緒分析一個新的句子中的每一行句子:斯坦福NLP情緒,在新線

C:\Users\alonr\IdeaProjects\stanford-corenlp-full-2014-08-27>java -cp "*" -mx2g 
edu.stanford.nlp.sentiment.SentimentPipeline -input TEXT -output PROBABILITIES -file 
my_file.txt 

遺憾的是它不承認在文件中作爲句子剎車線路剎車。我怎樣才能做到這一點?

+0

也許它不承認換行,因爲你的文件,使用Windows換行符('\ r \ n')是2個字符。您可以嘗試使用諸如NotePad ++之類的高級文本編輯器來打開此文件,並用'\ n'替換'\ r \ n'。 – cheseaux 2014-11-24 16:26:05

回答

0

主程序SentimentPipeline未設置爲允許更改分句符。如果您使用斯坦福CoreNLP,但是:你可以通過主CoreNLP管線與代替-ssplit.eolonly標誌運行:

java -cp "*" -mx2g edu.stanford.nlp.pipeline.StanfordCoreNLP \ 
    -annotators tokenize,ssplit,pos,parse,sentiment -ssplit.eolonly \ 
    -inputFile my_input.txt -outputFormat text -outputFile my_file.txt