NLTK中Wordnet的选择限制

2024-03-28 09:19:10 发布

您现在位置:Python中文网/ 问答频道 /正文

有没有一种方法可以通过NLTK从synsets获取WordNet的选择限制(比如+animate、+human等)? 或者有没有其他的方法来提供synset的语义信息?我能找到的最接近它的是同名关系。在


Tags: 方法信息关系语义wordnethumannltksynset
2条回答

你可以试着用一些相似性函数来筛选。但这本质上与遵循超词树是一样的——所有的wordnet相似性函数在计算中都使用了超词距离。另外,synset的许多可选属性可能值得探讨,但是它们的存在可能非常不一致。在

这取决于你的“选择限制”是什么,或者我称之为语义特征,因为在经典语义学中,存在着一个concepts的世界,要比较我们必须找到的概念

  • 区分特征(即用于区分它们的概念特征)和
  • 相似性特征(即概念的特征相似并突出区分它们的必要性)

例如:

Man is [+HUMAN], [+MALE], [+ADULT]
Woman is [+HUMAN], [-MALE], [+ADULT]

[+HUMAN] and [+ADULT] = similarity features
[+-MALE] is the discrimating features

传统语义学和将此理论应用于计算语义学的共同问题是

"Is there a specific list of features that we can use to compare any

"If so, what are the features on this list?" concepts?"

(参见www.acl.ldc.upenn.edu/E/E91/E91-1034.pdf更多详情)

回到WordNet,我可以建议两种方法来解决“选择限制”

首先,检查上一个词的区别特征,但是首先你必须决定什么是区别特征。为了区分动物和人类,让我们把区别特征作为[+-human]和[+-animal]。在

^{pr2}$

其次,按照@Jacob的建议检查相似性度量。

dog_sense = wn.synsets('dog')[0] # It's http://goo.gl/b9sg9X
jb_sense = wn.synsets('James_Baldwin')[0] # It's http://goo.gl/CQQIG9

# Features to check against whether the 'dubious' concept is a human or an animal
human = wn.synset('person.n.01') # i.e. [+human]
animal = wn.synset('animal.n.01') # i.e. [+animal]

if dog_sense.wup_similarity(animal) > dog_sense.wup_similarity(human):
  print "Dog is more of an animal than human"
elif dog_sense.wup_similarity(animal) < dog_sense.wup_similarity(human):
  print "Dog is more of a human than animal"

相关问题 更多 >