为什么Python WordNet接口在应该产生别名时会产生实例别名?

时间:2019-03-02 02:26:37

标签: python wordnet

我有一个应用程序,其中我需要区分作为实例的WordNet同义词集和不是实例的WordNet同义词集。我正在尝试通过在Python中使用synset.instance_hypernyms()synset.hypernyms()方法来做到这一点,如下面的简单Python脚本所示。我遇到了意外的和有问题的实例上位关系。

from nltk.corpus import wordnet as wn

agonistSynsets = wn.synsets("agonist")
print(agonistSynsets)

synsetCounter = 0
for synset in agonistSynsets:
    instanceHypernyms = synset.instance_hypernyms()
    hypernyms = synset.hypernyms()
    synsetCounter = synsetCounter + 1
    print(str(synsetCounter) + ': agonist synset ' + synset.name() + 
      ' has instance hypernyms ' + str(instanceHypernyms) +
      ' has hypernyms ' + str(hypernyms))

运行此脚本将产生:

[Synset('protagonist.n.02'), Synset('agonist.n.02'), Synset('agonist.n.03'), Synset('agonist.n.04')]
1: agonist synset protagonist.n.02 has instance hypernyms [Synset('fictional_character.n.01')] has hypernyms []
2: agonist synset agonist.n.02 has instance hypernyms [] has hypernyms [Synset('contestant.n.01')]
3: agonist synset agonist.n.03 has instance hypernyms [] has hypernyms [Synset('antagonistic_muscle.n.01')]
4: agonist synset agonist.n.04 has instance hypernyms [] has hypernyms [Synset('drug.n.01')]

因为激动剂不是一个实例,所以第二,第三和第四同义词集对我来说很有意义。但是,第一个同义集与fictional_character.n.01同义集产生实例关系,这不是我期望的。

在WordNet的Web界面中查找激动剂会产生:

Looking up "agonist" in WordNet

以上结果中没有一个激动剂的同义词集显示为Python fictional_character.n.01方法报告的synset.instance_hypernyms()同义词集的实例。

使用WordNet Web界面查找fictional character会产生:

enter image description here

此结果未将protagonist.n.02同义词集显示为fictional_character.n.01同义词集的实例。但是,主角一词确实在科学怪人实例的定义中出现过一次。

那么,为什么synset.instance_hypernyms()protagonist.n.02中显示fictional_character.n.01作为synset.hypernyms()的实例?为什么protagonist.n.02应该显示fictional_character.n.01时没有显示UPDATE VM1DTA.DCIRPG CM -- invalid column name cm SET ILCHDRNUM = -- incorrect syntax near SET and = (SELECT ILCHDRNUM FROM VM1DTA.DCIARG WHERE INCHDRNUM = CM.CHDRNUM); COMMIT; UPDATE dbo.DCIRPG CM -- invalid column name cm SET ILPYCLT = -- incorrect syntax near SET and = (SELECT CLNTKEY FROM dbo.DCIARG WHERE CLNTKEY = CM.PAYCLT --the multipath CM.PAYCLT can't bound AND SEQNUMB = 1 AND); 的上位词?为什么实例性上位词和上位词仅因一种激动剂而切换?这是一个错误吗?如果是,我应该在哪里报告?

谢谢。

0 个答案:

没有答案