Friday 15 January 2010

java - Finding out adjectives describing a noun using Stanford NLP -


I have to write a code that takes a few lines of comments about a product such as product based on adjectives Describe the product in the review as input and rate. I have just used POS Tagger to tag the parts of the speech of every comment. Now, I have to choose the adjectives that describe the nouns, and if a product appears to be related to the product, then I have to consider the adjective. This is the code that I have used for pOS tagging. It works just fine. Import java.io. *; Import edu.stanford.nlp.tagger.maxent.MaxentTagger; Public category tags {public static zero main (string [] args) throws IOException, ClassNotFoundException {string tag; // Tagger MaxentTagger tagger = new MaxentTagger ("edu / stanford / nlp / model / pos-tagger / wsj-left3words / wsj-0-18-left3words-distsim.tagger" start); FileInputStream fstream = New FileInputStream ("src / input.txt"); BufferedReader br = new BufferedReader (new InputStreamReader (fstream)); Fluorooter q = new fleeter ("src / output.txt", true); Buffed Worker Out = New Baffed Vitter (Q); String sample; // We will now take the sentence by line from file.txt file and store it in string sample while ((sample = br.readline ())! = Null {// tag tagging string tagger.tagString (sample); System.out.print (marked in "+ \ n"); // write it into the output file. tag in. Tag (tag); Out.newLine (); } Out.close (); }}

I want a way to move forward

A simple solution that you will find a long way to use dependency parser, which includes Stanford The core algorithm with NLP goes like this:

  1. POS tags and dependencies parse your sentence
  2. Determine which of the nouns you are interested in Keep it. If you are working with product reviews, then an easy way to do this is to match all the nouns in the text against a list of known product names.
  3. Look at the amod relationship in the output of the dependency parser, in which you are interested in the noun is included. Using the example:

    Input:

      I have a long glass and just bought a big red car.   

    amode dependence:

      amode (glass-5, long -4) amod (car-12, big -10 Amod (car-12, red-11)   

    Assume that the review cars are about the last two dependencies in the goal name car , and you The adjective that is looking for is therefore large and red .

    WARNING: This is a high-precise search algorithm instead of high memory, your keyword list will never be completed, so it is possible that you remember some adjectives. Besides, the parser is not right and will sometimes make mistakes. In addition, the amode relationship is an adjective in many ways that can describe a noun to an adjective. For example, "car is red" as

    pars

      det (car-2, the-1) nsubj (red-4, car- 2) Police (Red-4, I-3) Root (root-0, red-4) conjund (red-4, black-6) nsubj (black-6, car-2)   

    As you can see, there is no single amode relationship, just one copala and combination. You are trying to remove the fact that the car is red and the car is black whether you want to do it up is up to your present form, when This algorithm gives an adjective, you can certainly be confident that it is actually describing a noun. This is a good feature in my opinion, but it depends on the case of your use.


    Edit after comment by OP:

    Yes, I bought a new car. and This is awesome. There are two separate sentences and will be parsed separately. Known as this problem, it has been found that Stanford also supports it - see. I have not used any of these systems in Java, but there are very useful online demos at the same time, by entering the two sentences given above, I will

      [ I] bought [a new car] 2 [this] 2 is awesome    

No comments:

Post a Comment