8000 README update · apercis/stanford-corenlp-python@4452bba · GitHub
[go: up one dir, main page]

Skip to content

Commit 4452bba

Browse files
committed
README update
1 parent 3207767 commit 4452bba

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@ To use it in a regular script or to edit/debug (since errors via RPC are opaque)
5454
corenlp = StanfordCoreNLP()
5555
corenlp.parse("Parse an imperative sentence, damnit!")
5656

57-
I also added a function called **parse_imperative** that introduces a dummy pronoun to overcome the problems that dependency parsers have with imperative statements.
57+
I added a function called `parse_imperative` that introduces a dummy pronoun to overcome the problems that dependency parsers have with imperative statements.
5858

5959
corenlp.parse("stop smoking")
6060
>> [{"text": "stop smoking", "tuples": [["nn", "smoking", "stop"]], "words": [["stop", {"NamedEntityTag": "O", "CharacterOffsetEnd": "4", "Lemma": "stop", "PartOfSpeech": "NN", "CharacterOffsetBegin": "0"}], ["smoking", {"NamedEntityTag": "O", "CharacterOffsetEnd": "12", "Lemma": "smoking", "PartOfSpeech": "NN", "CharacterOffsetBegin": "5"}]]}]
6161

6262
corenlp.parse_imperative("stop smoking")
6363
>> [{"text": "stop smoking", "tuples": [["xcomp", "stop", "smoking"]], "words": [["stop", {"NamedEntityTag": "O", "CharacterOffsetEnd": "8", "Lemma": "stop", "PartOfSpeech": "VBP", "CharacterOffsetBegin": "4"}], ["smoking", {"NamedEntityTag": "O", "CharacterOffsetEnd": "16", "Lemma": "smoke", "PartOfSpeech": "VBG", "CharacterOffsetBegin": "9"}]]}]
6464

65+
Only with the dummy pronoun does the parser correctly identify the first word, *stop*, to be a verb.
6566

6667
<!--
6768
## Adding WordNet
@@ -78,7 +79,7 @@ If you think there may be a problem with this wrapper, first ensure you can run
7879

7980
# TODO
8081

82+
- Adjust Char Offsets for `parse_imperative` to account for dummy pronoun.
8183
- Parse and resolve coreferences
8284
- Mutex on parser
83-
- have pyexpect eat up dead chars after timeout (before next parse after a timeout)
8485

corenlp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,13 @@ def _parse(self, text, verbose=True):
143143
It returns a Python data-structure, while the parse()
144144
function returns a JSON object
145145
"""
146+
# clean up anything leftover
146147
while True:
147148
try:
148149
ch = self._server.read_nonblocking (2000, 1)
149150
except pexpect.TIMEOUT:
150151
break
151152

152-
# clean up anything leftover
153-
154153
self._server.sendline(text)
155154
# How much time should we give the parser to parse it?
156155
# the idea here is that you increase the timeout as a

0 commit comments

Comments
 (0)
0