I am trying to calculate semantic similarity between two words. I am using
Wordnet-based similarity measures i.e Resnik measure(RES), Lin
measure(LIN), Jiang, Conrath measure(JNC), and (LCH), but the similarity
value is not between [0-1], So i need to normalize the similarity values as
some measure give values between 0 and 1, while others give values greater
than 1. even the word is similar or different.
Code example:
from nltk.corpus import wordnet as wn
from nltk.corpus import wordnet_ic
brown_ic = wordnet_ic.ic('ic-brown.dat')
s1 = wordnet.synsets("car")
s2 = wordnet.synsets("car")
wn.wup_similarity(s1[0], s2[0])
1.0
wn.lch_similarity(s1[0], s2[0])
3.6375861597263857
wn.path_similarity(s1[0], s2[0])
1.0
wn.jcn_similarity(s1[0], s2[0], brown_ic)
1e+300
wn.res_similarity(s1[0], s2[0], brown_ic)
7.591401417609093
wn.lin_similarity(s1[0], s2[0], brown_ic)
1.0
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/d7a23f0b-6fb1-436d-b89a-6ce30517f733%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.