http://blog.csdn.net/pipisorry/article/details/42976457
Use of Stanford-parser
1, to Stanford official website http://nlp.stanford.edu/software/lex-parser.shtml download package, unzip.
2. Create a new Java project in Eclipse and extract the Stanford-parser.jar and Stanford-parser-3.*.*-models.jar two packages into the project reference package from the root directory.
Then extract the Parserdemo.java file from the root directory into the project SRC.
Use of Demo
First, directly run the instance program ( English Syntax parsing ):
1. Run it directly by tapping run
2. If you want to string[] sent from text input:
Eclipse > Run > Run configuration > Arguments > Program arguments:
Input: edu/stanford/nlp/models/lexparser/englishpcfg.ser.gzC:\Users\minglan\Desktop\test2.txt
Test2.txt:
The screen is really big and the price is too expensive!
The price is expensive, students don ' t buy it usually.
The screen was beautiful, but the price was not!
The screen is big and beautiful!
3. If you want to test Chinese, make the following changes:
(1) Change the input as needed to test Chinese:
string[] Sent = {"This", "Yes", "The first one", "Test", "sentence", ". " };
(2) Import analytic model file of Chinese:
Stringgrammar = args.length >0? args[0] : "Edu/stanford/nlp/models/lexparser/chinesepcfg.ser.gz";
(3) Modify some of the code in the source file:
TREEBANKLANGUAGEPACKTLP =NewChinesetreebanklanguagepack ();//penntreebanklanguagepack ();
If the error does not have the retaintmpsubcategories parameter, comment out the parameter in the source file:
string[] options = {"-maxlength", "a"};//, "-retaintmpsubcategories"};
Second, Stanford parser self-with graphical operation interface
Under Windows operating system, just double-click the Lexparser-gui.bat file under Run software root (Linux is the lexparser-gui.sh file)
Click "Load file" import need to parse the file can also be directly in the large input box above to parse the content,
In the "Language" option, select the language that corresponds to the resolution.
Click "Load Parser" to load the model file, wait a moment (loading the model file may take a few seconds) the "Parser" button becomes available when the progress bar completes loading, click to resolve the highlighted contents of the input box, the resulting tree results are shown in the bottom box,
You can save the result output as a file.
Third, Stanford parser also provides the command line way to Lexparser-gui.bat (win) and lexparser.sh (Linux) specific Use See official documentation: Stanford Parser FAQ
Four, Stanford parser has an online interpretation of the effect example in: http://nlp.stanford.edu:8080/parser/index.jsp
Ps:
Stanford CORENLP API documentation
from:http://blog.csdn.net/pipisorry/article/details/42976457
Ref:http://www.verydemo.com/demo_c173_i1328.html
Stanford Parser Detailed use