我正在尝试设置一个管道,它会生成词形还原的句子。我知道如何获取所有句子或所有引理,但我不知道如何获取除以句子结尾的引理集合。这是一个缺少参数的代码片段,用 ??????
标记:
AnalysisEngine pipeline = createEngine(createEngineDescription(
createEngineDescription(BreakIteratorSegmenter.class),
createEngineDescription(StanfordLemmatizer.class),
createEngineDescription(StopWordRemover.class, StopWordRemover.PARAM_MODEL_LOCATION,
new String[]{"stopwords.txt"})));
JCas jcas = JCasFactory.createJCas();
jcas.setDocumentText ("Almost all energy on Earth comes from the Sun. Plants make food energy from sunlight.");
jcas.setDocumentLanguage("en");
pipeline.process (jcas);
for (Sentence s : select(jcas, Sentence.class)) {
out.println("");
for (Lemma l : select(??????, Lemma.class))
out.print(l.getValue() + " ");
}
我需要在这段代码中更改什么,以便它从两行中的两个输入句子中打印引理。
最佳答案
给你:
for (Lemma l : JCasUtil.selectCovered(Lemma.class, s))
out.print(l.getValue() + " ");
披露:我正在从事 Apache UIMA 项目
关于java - 如何从 DKPro/UIMA 中的句子中获取引理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33979753/