-sentenceDelimiter java API 中的换行符

-sentenceDelimiter newline in java API

我可以从命令行 运行 POS 标记器将新行保留为

java -classpath stanford-postagger.jar edu.stanford.nlp.tagger.maxent.MaxentTagger -model models/wsj-0-18-bidirectional-distsim.tagger -sentenceDelimiter newline -textFile input.txt > output.txt 

给定参数“-sentenceDelimiter 换行符”。但我想知道如何在 java 程序中使用 API?

我在FAQ看到可以设置ssplit.newlineIsSentenceBreak,但是不知道怎么设置。

如有任何帮助或建议,我们将不胜感激。

我想在一行中标记这种句子。

 "what is your name?" he asked.

因为一行可能包含很多句子标记。

非常感谢。 什雷斯塔

可以使用ssplit.eolonly属性。根据documentation,就是"only split sentences on newlines. Works well in conjunction with '-tokenize.whitespace true', in which case StanfordCoreNLP will treat the input as one sentence per line, only separating words on whitespace."

props.setProperty("ssplit.eolonly", "true");
pipeline = new StanfordCoreNLP(props);