【问题标题】:calculate Similarity of two adverbs or two adjectives计算两个副词或两个形容词的相似度
【发布时间】:2013-03-20 03:58:16
【问题描述】:

我想写一个程序来计算两个副词或两个形容词的相似度,但是WordNet没有副词和形容词的本体结构。

在第一次尝试时,我使用了 Adapt-lesk 算法。该算法的结果对于副词或形容词来说非常令人失望。计算这些相似度的最佳方法是什么?请帮我解决这个问题。

谢谢大家。

【问题讨论】:

    标签: nlp similarity wordnet cosine-similarity wsd


    【解决方案1】:

    虽然很少见,但WordNet 有一个关系调用pertainym。它将相关形容词与其状语形式联系起来。如果您已安装 NLTK (http://nltk.org/) 并使用 python,您可以尝试以下示例:

    >>> from nltk.corpus import wordnet as wn
    >>> for ss in wn.all_synsets(): # loop through all synsets in WordNet
    ...     for l in ss.lemmas: # loop through the possible lemmas in that synsets.
    ...             x = j.pertainyms() # access lemma's pertainyms
    ...             if len(x) > 0:
    ...                     print str(ss.offset)+"-"+ss.pos, l, x
    

    【讨论】:

      猜你喜欢
      • 2018-06-26
      • 2014-12-15
      • 2015-05-03
      • 2012-01-14
      • 2017-06-09
      • 1970-01-01
      • 1970-01-01
      • 2022-08-19
      • 2011-10-06
      相关资源
      最近更新 更多