Skip to content
Related Articles

Related Articles

NLP | Leacock Chordorow (LCH) and Path similarity for Synset

View Discussion
Improve Article
Save Article
  • Last Updated : 29 Jan, 2019

Path-based Similarity: It is a similarity measure that finds the distance that is the length of the shortest path between two synsets.

Leacock Chordorow (LCH) : It is a similarity measure which is an extended version of Path-based similarity as it incorporates the depth of the taxonomy. Therefore, it is the negative log of the shortest path (spath) between two concepts (synset_1 and synset_2) divided by twice the total depth of the taxonomy (D) as defined in fig below.

Code #1 : Introducing Synsets.

from nltk.corpus import wordnet 
syn1 = wordnet.synsets('hello')[0
syn2 = wordnet.synsets('selling')[0
print ("hello name : ", 
print ("selling name : ", 

Output :

hello name :   hello.n.01
selling name :   selling.n.01

Code #2 : Path Similarity


Output :


Code #3 : Leacock Chordorow (LCH) Similarity


Output :


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!