【发布时间】:2015-07-15 20:09:29
【问题描述】:
我注意到斯坦福 CoreNLP 正在美国化输入,这破坏了我的一些代码,因为字符偏移不再累加。
我正在使用以下代码:
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))
[...]
请注意,输入包含单词honourable,但输出包含单词honorable。 colour 或 harbours 这样的词也会发生同样的情况。
有没有办法防止这种行为?我不介意在引理中使用它,但我想获得原始单词以便偏移匹配。
【问题讨论】:
-
使用选项
americanize=false,在此页面中指定:nlp.stanford.edu/software/tokenizer.shtml
标签: nlp stanford-nlp