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 python_inside_m...@googlegroups.com.
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.
Yes, but I didn't find any response.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/da1be2db-2448-4202-9c6f-b2238504506a%40googlegroups.com.
That stack overflow question is years old and answered. What is going on, indeed?
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CANEMyhMLA9VPNK7JoZ%3DuaZwpkFdmYePfD6-nj1SFivx3Qzyydg%40mail.gmail.com.
w, u) and what the difference between it and M(w,w). How to normalize a single measure
Let's consider a single arbitrary similarity measure
Mand take an arbitrary wordw.Define
m = M(w,w). Then m takes maximum possible value ofM.Let's define
MNas a normalized measureM.For any two words
w, uyou can computeMN(w, u) = M(w, u) / m.It's easy to see that if
Mtakes non-negative values, thenMNtakes values in[0, 1].How to normalize a measure combined from many measures
In order to compute your own defined measure
Fcombined of k different measuresm_1, m_2, ..., m_kfirst normalize independently eachm_iusing above method and then define:alpha_1, alpha_2, ..., alpha_ksuch that
alpha_idenotes the weight of i-th measure.All alphas must sum up to 1, i.e:
alpha_1 + alpha_2 + ... + alpha_k = 1Then to compute your own measure for
w, uyou do:F(w, u) = alpha_1 * m_1(w, u) + alpha_2 * m_2(w, u) + ... + alpha_k * m_k(w, u)It's clear that
Ftakes values in [0,1]
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/344f9795-5444-45c8-9e68-7b7514c5b57b%40googlegroups.com.
In the comments of that stack question it suggested you would need to be able to know the max range of each similarity measurement. If you know that, then you can normalise the values. So it's up to you to review the docs of each one.
What I do then? there are nltk-users group maybe anyone can solve it!!!
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8b58fc10-a4e3-410d-99a4-cae7da437031%40googlegroups.com.