Skip to content

Commit a57c6cc

Browse files
author
jmp3833
committed
return deps json from CoreNLP
1 parent 02cdd0f commit a57c6cc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

linguine/ops/StanfordCoreNLP.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
class StanfordCoreNLP:
1212

1313
proc = None
14-
1514
"""
1615
When the JSON segments return from the CoreNLP library, they
1716
separate the data acquired from each word into their own element.
1817
1918
For readability's sake, it would be nice to pair all of the information
20-
for a given word with that word, making a list of words with their
19+
for a given word with that word, making a list of words with their
2120
part of speech tags
2221
"""
2322
def jsonCleanup(self, data, analysisTypes):
@@ -28,7 +27,6 @@ def jsonCleanup(self, data, analysisTypes):
2827
words = []
2928
for index, token in enumerate(sentence_res["tokens"]):
3029
word = {}
31-
3230
word["token"] = sentence_res["tokens"][index]
3331
for atype in analysisTypes:
3432
if atype is "sentiment":
@@ -44,8 +42,11 @@ def jsonCleanup(self, data, analysisTypes):
4442
sentence['sentiment'] = sentence_res['sentiment']
4543
sentence['sentimentValue'] = sentence_res['sentimentValue']
4644
sentence['sentiment_json'] = json.loads(sentence_res['sentiment_json'])
45+
4746
if "parse" in analysisTypes:
4847
sentence["parse"] = sentence_res["parse"]
48+
49+
sentence['deps_json'] = json.loads(sentence_res['deps_json'])
4950
sentences.append(sentence)
5051

5152
return sentences

0 commit comments

Comments
 (0)