-1

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.

Rohit Minni
  • 250
  • 1
  • 3
  • 8
  • Do you need to do syntactic analysis to extract the noun, or do you assume that if a phrase continues after a verb then there is a noun somewhere? Are the nouns limited to some noun list you have? – ilomambo Jan 10 '14 at 05:57
  • I will use a tagger to extract the nouns. The nouns that I need to be extract would be the common ones like flower, chocolate etc and would later be matched with an RDF attribute. But if a semantic analyzer is available, it would be great too. It would increase the accuracy of the system – Rohit Minni Jan 10 '14 at 07:00

1 Answers1

0

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.

ilomambo
  • 8,290
  • 12
  • 57
  • 106
  • do we have a similar offline parser for android? The online parser was something that was really useful. I can parse the text and then use regex along with OWL to get the work done. Thanks – Rohit Minni Jan 10 '14 at 08:06
  • @rohitminni Actually, in the linked page in my answer the second "here" link shows you how to use it from your own webpage javascript code. I did not dwell into it, but maybe it is what you are looking for. – ilomambo Jan 10 '14 at 11:13
  • @rohitminni Also, in the home page for the Standford parser (see the above link and you will find it) you have some interesting references to extensions in Java and other languages, besides being able to download the parser itself. – ilomambo Jan 10 '14 at 11:19