[英]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項目
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.