Text Mining – Measuring Semantic Distance Between Phrases Using Closest Distance in Hypernym Tree

distance-functionstext mining

Per my earlier question I'm trying to find a reasonable metric for the semantic distance between two short text strings. One metric mentioned in the answers of that question was to use shortest hypernym path to create a metric for phrases. So for instance, if I was to find the semantic distance between pig and dog, I could ask WordNet for all of their hypernyms:

pig=> swine=> even-toed ungulate=> hoofed mammal=> placental mammal=> mammal=> vertebrate=> chordate=> animal=> organism=> living thing=> object=> physical entity=> entity

dog=> canine=> carnivore=> placental mammal=> mammal=> vertebrate=> chordate=> animal=> organism=> living thing=> object=> physical entity=> entity

and I would find that the shortest path between pig and dog is 8 jumps – so semantic distance = 8.

If I wanted to extend this concept to entire phrases, then perhaps I could (naively) find the average distance between all word pairs in the phrases. (Obviously, one should be able to find something much better than this.)

My question: I'm sure someone has thought of this before. Where should I look in literature to find more information. And what are the hidden gotchas when using such an approach.

Best Answer

Graph Distances

For words I'd guess you're looking for a distance measure defined over a tree/graph, e.g. geodesic distance and related constructions, but which covers phrases. I wonder if you could treat the phrases as subtrees/subgraphs within the larger graph structure and use a tree similarity measure, e.g. tree edit distance to get a similarity measure?

Distributional Distances

But for a return to the geometrical (rather than graph structure) approach for answering your previous tweet-related question I suggest googling 'semantic space'. It was big in the late 90's and seems to be having a big data revival. You'll get a lot of Latent Semantic Analysis / Indexing but the intuitions about semantic distance in a semantic space are the same whether it's about words or phrases and whether or not there is a dimensionality reduction first. These intuitions are basically:

  1. meaning is distributional similarity a.k.a. substitutability in context.
  2. semantic similarity is usually the (cosine of the) angle between two word vectors.

A more or less random collection of links include e.g. this intro and this thesis, work by H. Schütze, T. Pederson, S. Finch and N. Chater, S. Evert, but there is a lot more out there.

In the general framework phrases can be turned into single vectors by adding (or otherwise combining) their word vectors together before angles are computed.

Some software for constructing these semantic spaces is here or more recently here.