2014-01-27 28 views
-4

我想找到两个synsets之间的相关性,我遇到了像resnik,lin,wu palmer,路径算法,leacock chodorow等许多算法。有人可以告诉我哪个算法最有效吗?语义相关性算法 - python

+0

我在https://github.com/alvations/pywsd中添加了最大化相似度功能 – alvas

回答

1

从“告诉我一个例子”的角度看,这里有一个例子来说明如何利用语义相似度进行WSD :

from nltk.corpus import wordnet as wn 
from nltk.tokenize import word_tokenize 

def max_wupa(context_sentence, ambiguous_word): 
    """ 
    WSD by Maximizing Wu-Palmer Similarity. 

    Perform WSD by maximizing the sum of maximum Wu-Palmer score between possible 
    synsets of all words in the context sentence and the possible synsets of the 
    ambiguous words (see http://goo.gl/XMq2BI): 
    {argmax}_{synset(a)}(\sum_{i}^{n}{{max}_{synset(i)}(Wu-Palmer(i,a))} 

    Wu-Palmer (1994) similarity is based on path length; the similarity between 
    two synsets accounts for the number of nodes along the shortest path between 
    them. (see http://acl.ldc.upenn.edu/P/P94/P94-1019.pdf) 
    """ 

    result = {} 
    for i in wn.synsets(ambiguous_word): 
    result[i] = sum(max([i.wup_similarity(k) for k in wn.synsets(j)]+[0]) \ 
        for j in word_tokenize(context_sentence)) 
    result = sorted([(v,k) for k,v in result.items()],reverse=True) 
    return result 

bank_sents = ['I went to the bank to deposit my money', 
'The river bank was full of dead fishes'] 
ans = max_wupa(bank_sents[0], 'bank') 
print ans 
print ans[0][1].definition 

(来源:pyWSD @ github

使用上面的代码小心,因为你需要考虑:

  1. 当我们尝试最大化上下文句子中所有令牌的所有可能同义词之间的路径相似性以及可能的歧义词的同义词时,真的发生了什么?
  2. 如果大部分路径相似性产生了None,那么它甚至是逻辑的最大化,偶然你会得到一些流氓词,它们与歧义词的synset之一有相关的同义词?
5

首先,OPs的相关性和相似性之间的混淆,区别很好,但值得注意。

语义相关使用任何种类的关系度量两个概念之间的关系;算法:

  • 词汇链(赫斯特和St-昂格,1998)
  • 改编/扩展感重叠算法(纳吉和Pedersen,2002/2003)
  • 矢量化感重叠(Patwardhan,2003)

语义相似度只考虑IS-A关系(即上位词/下位词);算法:

  • 武帕尔默措施(Wu和1994年帕尔默)
  • 雷斯尼克措施(1995年雷斯尼克)
  • 江Conrath措施(江和1997年Conrath)
  • 利科克-Chodorow措施(里柯克和Chodorow 1998)
  • 林措施(1998年摄)

雷斯尼克,江Conrath和林措施是基于信息CON帐篷。 synset的信息内容是记录该同义词中所有单词的所有概率(从语料库频率计算)的总和(Resnik,1995)。

Wu-Palmer和Leacock-Chodorow基于路径长度;两个概念/同义词之间的相似性是沿着它们之间最短路径的节点的数量。

上面给出的列表是无穷无尽的,但从历史上看,使用相似性度量有点过时,因为相关性算法考虑更多的关系,并且应该在理论上给出比较概念的更多消除歧义的能力。


接着,效率被定义不佳。有关速度或准确性?对于哪些任务会应用语义相关性/相似性?

如果任务是Word Sense Disambiguation(WSD),那么参考Warin(2004)论文:http://goo.gl/6wWums会很好。或者更新调查的Navigli(2009)http://dl.acm.org/citation.cfm?id=1459355

如果WSD而言,还有更复杂的工具/方法,请参考Anyone know of some good Word Sense Disambiguation software?


参考

Satanjeev班纳吉和Ted佩德森。 2002.一种适用于WordNet的词义消歧算法Lesk算法。在第三届计算语言学和智能文本处理国际会议论文集(CICLing '02),Alexander F. Gelbukh(编辑)中。 Springer-Verlag,London,UK,UK,136-145。

Satanjeev Banerjee和Ted Pedersen。扩展光泽重叠作为语义相关性的度量。在第十八届国际人工智能联合会议论文集,第805-810页,阿卡普尔科。

Graeme Hirst and David St-Onge,1998. Lexical Chains as Representations of Contextations for the Detection and Correction of Malapropisms,第13章, ,第305-332页。麻省理工学院出版社,麻省剑桥

Siddarth Patwardhan。将词典和语料库信息纳入语义相关性的语境向量量度。硕士论文,明尼苏达大学 。

(懒得列出所有的引证,请搜索和附加到这个答案正确)