Defining grammar based rules and inferences in android

I have to collect information from a source and classify the information based on certain rules. The input would be a text file. Eg: "Raj loves eating chocolates. Rohan likes flowers. Ravi is very popular."

From what I have learnt till date, we can tag the text based on nounphrases, verbphrase etc. So, I am planning to tag the text first. Now I want to define rules like:

if nounphrase appears after "love*" then add chocolate to the list. Similarly, if nounphrase appears after "like*" then add flowers to the list.

Now, for classification, I will create a RDF defining classes and individuals for chocolate and flowers.

My question here is 1. How do I define the grammar based rules in Android? 2. After getting the noun phrases how do I classify those nouns under a class of items of which is defined in the RDF?

Thanks.

Answers


I assume you are asking about how to program,not how to use Android as OS.

Unfortunately there are no grammar tools in java for Android, you would have to use a parser for natural language (see this parser online, also has an API for programming). Parsers like YACC, BISON, ANTLR or similar (you'll get a lot of info by Googleing those terms) are no good for you since they require unambiguous grammars, and natural language is nothing but unambiguous.

If your input is relatively simple you should consider using some sort of regular expression parsing and classification. It is much simpler and easier to implement. Java does support all sort of string manipulation with regular expressions.


Need Your Help

How to associate an Office 365 Trial account with my own domain?

dns ms-office office365

How can I associate the office 365 trial account with my own domain?

json.net vs DataContractJsonSerializer

c# .net asp.net json json.net

I know there's a DataContractJsonSerializer that comes now with the .net framework and is used by wcf ajax enabled services. However, I've noticed there's also a json.net project over at codeplex.