WordNet Similarity is used to perform semantic matching. In this, a similarity of a given text is computed against the hypothesis. The Natural Language Toolkit can be used to compute: path distance, Leacock-Chodorow Similarity, Wu-Palmer Similarity, Resnik Similarity, Jiang-Conrath Similarity, and Lin Similarity between words present in the text and the hypothesis. In these metrics, we compare the similarity between word senses rather than words.
During Shallow Semantic analysis, NER and coreference resolution are also performed.
Consider the following code in NLTK that computes wordnet
similarity:
>>> wordnet.N['dog'][0].path_similarity(wordnet.N['cat'][0]) 0.20000000000000001 >>> wordnet.V['run'][0].path_similarity(wordnet.V['walk'][0]) 0.25