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
Post a Comment