8000 added NLTK example · spprabhu/stanford-corenlp-python@5d5648b · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d5648b

Browse files
committed
added NLTK example
1 parent 25f5f7a commit 5d5648b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This is a Python wrapper for Stanford University's NLP group's Java-based [CoreN
55

66
* Python interface to Stanford CoreNLP tools: tagging, phrase-structure parsing, dependency parsing, named entity resolution, and coreference resolution.
77
* Runs an JSON-RPC server that wraps the Java server and outputs JSON.
8-
* Outputs parse trees which can be used in `nltk`
8+
* Outputs parse trees which can be used by [nltk](http://nltk.googlecode.com/svn/trunk/doc/howto/tree.html).
99

1010

1111
It requires [pexpect](http://www.noah.org/wiki/pexpect) and (optionally) [unidecode](http://pypi.python.org/pypi/Unidecode) to handle non-ASCII text. This script includes and uses code from [jsonrpc](http://www.simple-is-better.org/rpc/) and [python-progressbar](http://code.google.com/p/python-progressbar/).
@@ -139,6 +139,6 @@ You can reach me, Dustin Smith, by sending a message on GitHub or through email
139139

140140
This is free and open source software and has benefited from the contribution and feedback of others. Like Stanford's CoreNLP tools, it is covered under the [GNU General Public License](http://www.gnu.org/licenses/gpl-2.0.html), which in short means that modifications to this program must maintain the same free and open source distribution policy.
141141

142-
* Justin Cheng jccf@221513ecf322dc32d6e088fb2f68751e45bac226
142+
* Justin Cheng jcccf@221513ecf322dc32d6e088fb2f68751e45bac226
143143
* Abhaya Agarwal 8ed7640388cac8ba6d897739f5c8fe24eb87cc48
144144

client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@
2121
import pprint
2222
result = json.loads(server.parse("Hello world! It is so beautiful."))
2323
pprint.pprint(result)
24+
25+
# example using nltk
26+
from nltk.tree import *
27+
tree = Tree.parse(result['sentences'][0]['parsetree'])
28+
print tree
29+
print tree.leaves()

0 commit comments

Comments
 (0)
0