如何从DKPro / UIMA的句子中获取引理?

时间:2015-11-29 05:36:28

标签: java nlp uima dkpro-core

我正在尝试设置一个管道,它会产生词汇化的句子。我知道如何得到所有的句子或所有的lemmas,但我不知道如何得到句子集合的句子结尾。这是一个带有??????标记的缺失参数的代码段:

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() + " ");
}

我需要在此代码中更改什么,因此它会从两行输入的句子中打印出lemmas。

1 个答案:

答案 0 :(得分:2)

你走了:

for (Lemma l : JCasUtil.selectCovered(Lemma.class, s)) 
    out.print(l.getValue() + " ");

披露:我正在开发Apache UIMA项目