What are some good methods to find the “relatedness” of two bodies of text?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 19:45:58
jjclarkson

These articles on semantic relatedness and semantic similarity may be helpful. And this SO question about Latent Semantic Analysis.

You could also look into Soundex for words that "sound alike" phonetically.

I've never used it, but you might want to look into Levenshtein distance

Bob

Jeff talked about something like this on the pod cast to find the Related questions listed on the right side here. (in podcast 32)

One big tip was to remove all common words, like "the" "and" "this" etc. This will leave you with more meaningful words to compare.

And here is a similar question Is there an algorithm that tells the semantic similarity of two phrases

This is quite doable for reasonable large texts, however harder for smaller texts.

I did it once like this, and it worked pretty well:

  • Filter all "general" words (like a, an, the, in, etc...) (filters about 10-30% of the words)
  • Count the frequencies of the remaining words, store the top x of most frequent words, these are your topics.
  • As an extra step you can create groups of 2/3/4 subsequent words and compare them with the groups in other texts. I used it as a measure for plagerism.

See Manning and Raghavan course notes about MinHashing and searching for similar items, and a C#(?) version. I believe the techniques come from Ullman and Motwani's research.

Dima

This book may be relevant.

Edit: here is a related SO question

Even Mien

Phonetic algorithms

The article, Beyond SoundEx - Functions for Fuzzy Searching in MS SQL Server, shows how to install and use the SimMetrics library into SQL Server. This library lets you find relative similarity between strings and includes numerous algorithms.

I ended up mostly using Jaro Winkler to match on names. Here's more information where I asked about matching names on SO: Matching records based on Person Name

A few algorithms based on Levenshtein Distance are also available in the SimMetric library and would probably be useful in your application.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!