Reputation: 11
We have created the parse tree from the command line using this command :
java -mx1g -cp "*" edu.stanford.nlp.parser.lexparser.LexicalizedParser -sentences newline -tokenized -tagSeparator / -tokenizerFactory edu.stanford.nlp.process.WhitespaceTokenizer -tokenizerMethod newCoreLabelTokenizerFactory edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz data/for.txt
and upto this we got the correct output of the input file as tree format.
But we want the output like : http://nlp.stanford.edu:8080/parser/
Universal dependencies nmod:poss(dog-2, My-1) nsubj(likes-4, dog-2) advmod(likes-4, also-3) root(ROOT-0, likes-4) xcomp(likes-4, eating-5) dobj(eating-5, sausage-6) Universal dependencies, enhanced nmod:poss(dog-2, My-1) nsubj(likes-4, dog-2) advmod(likes-4, also-3) root(ROOT-0, likes-4) xcomp(likes-4, eating-5) dobj(eating-5, sausage-6)
Kindly share the JAVA code to produce this output.
Upvotes: 1
Views: 397
Reputation: 8739
Download Stanford CoreNLP 3.6.0 from here: http://stanfordnlp.github.io/CoreNLP
run this command from within the directory you just downloaded:
java -Xmx3g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,depparse -file sample_text.txt -outputFormat text
Upvotes: 1