Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question
5  
Read the Wikipedia article on Natural Language Processing, especially the "The future of NLP" chapter. What you're asking doesn't (yet) have a 100% solution, so you should start looking at compromises. –  Cosmin Prund Feb 26 '13 at 11:46
add comment

4 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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 Mar 11 '13 at 16:07
add comment

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."

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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