Is wordnet path similarity commutative?

后端 未结 2 826
心在旅途
心在旅途 2020-12-10 02:52

I am using the wordnet API from nltk. When I compare one synset with another I got None but when I compare them the other way around I get a float value.

<
2条回答
  •  没有蜡笔的小新
    2020-12-10 03:24

    I don't think it is a bug in wordnet per se. In your case, automobile is specified as a verb and car as noun, so you will need to look through the synset to see what the graph looks like and decide if the nets are labeled correctly.

    A = 'car.n.01'
    B = 'automobile.v.01'
    C = 'automobile.n.01'
    
    
    wn.synset(A).path_similarity(wn.synset(B)) 
    wn.synset(B).path_similarity(wn.synset(A)) 
    
    
    wn.synset(A).path_similarity(wn.synset(C)) # is 1
    wn.synset(C).path_similarity(wn.synset(A)) # is also 1
    

提交回复
热议问题