I am working on a website (C#, ASP.Net MVC 3) which reads some RSS feeds from multiple sources and put feed title and summary in a database table(Sql Server).

What I want to do is: Put an algorithm in place which can relate multiple feeds. For example if each feed is a news item, I would like to relate all news which says in different grammar of English "Some has won some election".

Is there any standard algorithm for such kind of content matching logic? If not, what kind of custom algorithm should be used?

If this logic can be written on Database side(e.g. Stored Procedure) it will be better.


5 Answers 5


As @Cosmin-Prund said, there's no trivial or good pre-existing way to do this. My off-the-top-of-my-head suggestion would be to use a search engine like Lucene to tokenize and store the feed title. Use a stemming tokenizer, so that you can match words even if they're in different forms (such as wins vs winning). Then, when you process a new feed, you can search for the title as keywords, and see what you get back. You'll have to play with it some to find out how to tune the results to do what you want (try dropping the two most common tokens?), but it ought to be in the right ballpark of what you're looking for.


I've actually been looking into doing something similar. As a good starting point, I found an open source project called mahout which implements most of the algorithms you need, although it is far from a plug and play solution.

The three use cases you might be interested in are clustering, recommendation, and classification. They all basically group items into related topics, but in subtly different ways.

  • Use recommendation when you have a bunch of news articles and are trying to determine which ones you are most likely to like based on your past reading habits and those of readers similar to you.
  • Use classification when you want to group the news articles into subjects, and you know beforehand what those subjects should be. This is most useful for long term, ongoing topics, like the weather, for example.
  • Use clustering when you want to group the news articles into basic subjects, and you don't know beforehand what those subjects should be. This is most useful for one-time events, like the death of Hugo Chavez, for example.

If you're looking for a more complete solution, check out Carrot2. It is only able to handle around 1,000 documents, though. Perhaps useful if you are only interested in clustering one day's worth of news from a few select rss feeds.


I've used an approach based on Levenshtein distance to find similar phrases and words. It doesn't understand semantics, but it's used to find a concrete number telling "how similar are these two phrases". The algorithm itself are quick and easy and I know it's implemented in a few databases as well.

  • It's a good idea in theory, but the problem with it is that a single-word change can make a huge difference. Consider: Hurricane Strikes New Orleans, causes mass devastation vs Hurricane Strikes New Jersey, causes mass devastation. One is a news story from 2005, the other is from 2012.
    – Bobson
    Commented Mar 11, 2013 at 16:07

On the Database side, the Postgresql database engine, since version 8.3, has the feature: Fuzzy String Match

It "provides several functions to determine similarities and distance between strings."


I suppose you can take a minhash based near duplication detection approach since the text is relatively long (considering the content). There's a good article here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.