Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
防止Stanford CoreNLP将输入美国化_Nlp_Stanford Nlp - Fatal编程技术网

防止Stanford CoreNLP将输入美国化

防止Stanford CoreNLP将输入美国化,nlp,stanford-nlp,Nlp,Stanford Nlp,我注意到StanfordCorenlp正在美国化输入,这打破了我的一些代码,因为字符偏移量不再累加 我正在使用以下代码: String annotators = "tokenize, ssplit, pos, lemma, ner, parse, dcoref"; Properties props = new Properties(); props.put("annotators",annotators); this.pipeline = new StanfordCoreNLP(props);

我注意到StanfordCorenlp正在美国化输入,这打破了我的一些代码,因为字符偏移量不再累加

我正在使用以下代码:

String annotators = "tokenize, ssplit, pos, lemma, ner, parse, dcoref";
Properties props = new Properties();
props.put("annotators",annotators);
this.pipeline = new StanfordCoreNLP(props);
this.annotators = annotators;
Annotation document = new Annotation(text);
pipeline.annotate(document);
pipeline.prettyPrint(document, resp.getWriter());
通过以下输入:

But, at the other end of the town, in his own little hut, there dwelt an honourable laborer.
我得到:

[...]
[Text=an CharacterOffsetBegin=70 CharacterOffsetEnd=72 PartOfSpeech=DT]    
[Text=honorable CharacterOffsetBegin=73 CharacterOffsetEnd=83 PartOfSpeech=JJ] 
[Text=laborer CharacterOffsetBegin=84 CharacterOffsetEnd=91 PartOfSpeech=NN]
[...]
(NP (DT an) (JJ honorable) (NN laborer))
[...]
请注意,输入有单词
honorible
,但输出有单词
honorible
。像
颜色
港口
这样的词也会发生同样的情况


有没有办法防止这种行为?我不介意在引理中这样做,但我想让原始单词匹配偏移量。

在CoreNLP的代码中,您想添加以下属性:

props.put("tokenize.options", "americanize=false");

使用本页中指定的选项
americanize=false
:谢谢!我使用的是
props.put(“options”
,而不是
props.put(“tokenize.options”