如何从 DKPro/UIMA 中的句子中获取引理?
How to get lemmas from sentences in DKPro/UIMA?
我正在尝试设置一个生成词形还原句子的管道。我知道如何获取所有句子或所有引理,但我不知道如何获取除以句末的引理集合。这是一个代码片段,缺少由 ??????
:
标记的参数
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 项目
我正在尝试设置一个生成词形还原句子的管道。我知道如何获取所有句子或所有引理,但我不知道如何获取除以句末的引理集合。这是一个代码片段,缺少由 ??????
:
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 项目