Stanford Parser is a tool for grammatical analysis developed by Stanford University and belongs to one of the Stanford NLP series tools. This article mainly introduces the usage of Standfor parser.
- Download the latest installation package (currently 3.6.0) on the official website of Stanford, click Download to download the latest model Stanford-english-corenlp-2016-01-10-models.jar
- Unzip the downloaded zip package stanford-parser-full-2015-12-09.zip, there will be data, dependencies and demo, as well as the relevant source code and Java doc
- Create a project using Eclipse, name Stanfordparser, in the build Slf4j-api.jar,slf4j-simple.jar,stanford-parser.jar,stanford-parser-3.6.0-models.jar,stanford-english-corenlp-2016-introduced in Path 01-10-models.jar
- Take Parserdemo as an example, create a class Parserdemo.java in Stanfordparser, find Parserdemo in the directory that you unzipped in step 2, copy the contents to the Parserdemo of the current project
- Right-click the Parserdemo.java file in Eclipse and set the run parameter arguments to: edu/stanford/nlp/models/lexparser/englishpcfg.ser.gz c:/ Parserdata/english-onesent.txt, the first parameter is the PCFG path, the models has been provided, the second parameter is the data file to be analyzed, in the Extract directory of Step 2 under Data
- The final step runs with the following output:
(ROOT
(S
(NP (DT) (JJ Quick) (JJ Brown) (NN Fox))
(VP (VBD jumped)
(PP (in)
(NP (DT The) (JJ-Lazy) (NN Dog))))
(. .)))
[Det (fox-4, The-1), Amod (fox-4, quick-2), Amod (fox-4, brown-3), NSUBJ (jumped-5, fox-4), Root (ROOT-0, jumped-5), Case ( Dog-9, over-6), Det (dog-9, the-7), Amod (dog-9, lazy-8), Nmod:over (Jumped-5, dog-9)]
Standford Parser Learning Primer (1) configuration in-eclipse