6

I am building an app that analyzes posts by people by pulling their Tweets and Facebook posts. I need to process all the posts and find useful phrases. What I mean by useful is that, any word or phrase that is a noun/adjective/verb that would represent a discrete object or an idea, or in other words, I am looking for keywords.

For example, if someone has posted those three posts (in a very simple sense):

i am a big fan of progressive metal music! it is fantastic!

Look what I've found: a new Progressive Metal band!

a good genre in music is progressive metal

Analyzing those simple examples, I need to extract progressive metal and music with the highest occurrence rank. But if I pass the occurrences of words simply, I'll be getting a, is, I as the most common words. If I get away with the propositions, then I'll be getting single words such as progressive, metal, music. What I really need is to get phrases such as progressive metal, or progressive metal music, which together actually make sense. As a word, progressive and metal have other meanings, but the phrase progressive metal defines a musical genre, which has nothing to do with the single words themselves. Iteratively searching occurrence of every possible phrase in all the posts (e.g. first search i in all posts, then i am, then i am a etc.) is computationally extremely expensive and is not an option.

I've looked at some similar questions:

Available options for classifying words in text?

Language parsing to find important words

But both are overkills, solving (or trying to solve) more general problems. My problem is more specific and I'm thinking of a simpler solution that doesn't involve NLP. An idea one might come up with is to compare the posts against a valid word/phrase list, but people might be talking about a brand related name, or a specific event, that are not available in a dictionary, such as Twitter API, or death of Michael Jackson.

I am currently evaluating posts against the user's Facebook likes, which makes a good dictionary of valid phrases about the user, but it fails when we are on Twitter, without the notion of "likes", hence, no valid dictionary. Is there any simple way of checking occurrence of valıd terms in a large array of sentences? (not necessarily grammatically correct)

UPDATE: It's an iOS app so I'm in Objective-C, to keep in mind in library recommendations.

4
  • 1
    I have a feeling that any solution that does what you want will involve some amount of NLP. Commented Jan 8, 2013 at 14:55
  • well, unless it is quite sophisticated, i'm ok with that. i don't know anything about NLP (though I took AI courses in the college), but if, for my purpose, it is easy, then i can use it. Commented Jan 8, 2013 at 15:17
  • Hey, i need the same thing, you have sucess? Commented May 8, 2016 at 13:16
  • @user3715916 unfortunalely. i've abandoned the project. Commented May 9, 2016 at 5:39

1 Answer 1

4

A very rough outline how this could be done with Apache Solr.

Solr is a full text search engine with many setup options and very flexible ways to handle the indexing and faceting. Using the right combinations of tokenizers (split text in single elements, mostly words) and filters (post process the tokens like removing stop words as "a", "and", "I" etc or converting to lower case) you could get reasonable results. Especially since you can handle a single text in several ways at the same time by tokenizing and filtering it into more than one field.

Doing this would allow to index single words and word groups with or without stopwords. Running a facet search would count the occurrences of such words or groups.

The main work would be to find a good way to create the word groups. I'm not sure right now if one of the default tokenizers or filters would be good for that. Though you could write your own as a plugin in Java.

I guess there are better solutions with specialized tools, but I'm rather sure with Solr it could be done to a certain degree.

3
  • I've searched about Solr, and came to the conclusion that there are no wrappers/similar alternatives to Solr on Objective-C, which is I am coding in. but if you have some abstract solutions without the use of a library, i'll be glad to implement the features only that I need from that startup idea. Commented Jan 8, 2013 at 15:27
  • 1
    If you can export the data into XML, you could do a lot from the command line. Anyway, Solr interacts through a html interface and it should be rather simple to implement basic functionality with Objective-C (like generate URL string with query parameters and send it to port 8080). I'm using it from Ruby on Rails and only use some very basic functionality from the library that exists for Ruby. Commented Jan 8, 2013 at 15:43
  • i CAN export the data, my i am actually trying to avoid a use of a server completely, and doing everything client-side, in-app. Commented Jan 8, 2013 at 15:54

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.