java - Unable to extract noun pharses from the result of open nlp Chunking parser -


hi have used opennlp chunking parser , parsed text , of below stack overflow question have tried extract noun phrases

how extract noun phrases using open nlp's chunking parser

but unable extract noun phrases, below code

public class keywords {     list<parse> nounphrases;     public static void main(string args[])throws invalidformatexception, ioexception {         inputstream = new fileinputstream("en-parser-chunking.bin");          parsermodel model = new parsermodel(is);          opennlp.tools.parser.parser parser = parserfactory.create(model);          string sentence = "programcreek huge , useful website";         parse topparses[] = parsertool.parseline(sentence, parser, 1);          (parse p : topparses)         {             p.show();             p.tostring();         }         is.close();      }     public void getnounphrases(parse p) {         if (p.gettype().equals("np")) {              nounphrases.add(p);         }         (parse child : p.getchildren()) {              getnounphrases(child);         }     }  } 

please suggest me in extracting np parsed content

thanks

yo should pass string in token format below:  new string[]{          "programcreek ",                 "is",                 "a",                 "very",                 "huge",                 }; 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -