【问题标题】:Stanford CorpNLP returning wrong results斯坦福公司 NLP 返回错误结果
【发布时间】:2015-02-23 16:46:18
【问题描述】:

this 问题之后,我正在尝试使用 stanford corenlp 进行词形还原。我的环境是:-

我的代码 sn-p 是:-

//...........lemmatization starts........................

    Properties props = new Properties(); 
    props.put("annotators", "tokenize, ssplit, pos, lemma"); 
    StanfordCoreNLP pipeline = new StanfordCoreNLP(props, false);
    String text = "painting"; 
    Annotation document = pipeline.process(text);  

    List<edu.stanford.nlp.util.CoreMap> sentences = document.get(SentencesAnnotation.class);

    for(edu.stanford.nlp.util.CoreMap sentence: sentences) 

    {    
        for(CoreLabel token: sentence.get(TokensAnnotation.class))
        {       
            String word = token.get(TextAnnotation.class);      
            String lemma = token.get(LemmaAnnotation.class); 
            System.out.println("lemmatized version :" + lemma);
        }
    }

    //...........lemmatization ends.........................

我得到的输出是:-

lemmatized version :painting

我期待的地方

lemmatized version :paint

请赐教。

【问题讨论】:

    标签: java-7 stanford-nlp eclipse-3.4 lemmatization


    【解决方案1】:

    这个例子中的问题是,绘画这个词可以是 to paint 的现在分词或名词,并且词形还原器的输出取决于分配给原始词的词性标签单词。

    如果您只在片段painting 上运行标记器,那么没有上下文可以帮助标记器(或人类)决定应该如何标记单词。在这种情况下,它选择了标签NN,而名词painting的引理实际上是painting

    如果您使用“我正在画一朵花”这句话运行相同的代码。标记器应正确地将 painting 标记为 VBG,并且词形还原器应返回 paint

    【讨论】:

    • 没关系。但是如果我有“绘画”之类的词,我需要“绘画”。我应该使用什么其他 api / 工具?我无法向 API 发送句子。
    • 如果标签依赖于上下文,将没有任何工具能够根据单个单词推断出正确的 POS 标签。但是,如果您事先知道该单词将是动词,则可以手动标记它,然后运行词形分析器。
    • 塞巴斯蒂安。请帮助我手动标记单词。我在网上找不到任何代码
    猜你喜欢
    • 1970-01-01
    • 2017-06-20
    • 1970-01-01
    • 2014-04-26
    • 1970-01-01
    • 2016-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多