Finding occurrences of a useful words and phrases in strings

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

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

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật