Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions corenlp/corenlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
WORD_PATTERN = re.compile('\[([^\]]+)\]')
CR_PATTERN = re.compile(r"\((\d*),(\d)*,\[(\d*),(\d*)\)\) -> \((\d*),(\d)*,\[(\d*),(\d*)\)\), that is: \"(.*)\" -> \"(.*)\"")

DIRECTORY = "stanford-corenlp-full-2013-06-20"
DIRECTORY = "stanford-corenlp-full-2015-04-20"


class bc:
Expand Down Expand Up @@ -158,7 +158,11 @@ def parse_parser_results(text):
line = line.strip()

if line.startswith("Sentence #"):
sentence = {'words': [], 'parsetree': [], 'dependencies': []}
index = line.index("sentiment: ")
length = len("sentiment: ")
sentiment = line[(index+length):-2]
sentence = {'sentiment': [], 'words': [], 'parsetree': [], 'dependencies': []}
sentence['sentiment'] = sentiment
results["sentences"].append(sentence)
state = STATE_TEXT

Expand Down
2 changes: 1 addition & 1 deletion corenlp/default.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
annotators = tokenize, ssplit, pos, lemma, depparse
annotators = tokenize, ssplit, pos, lemma, depparse, parse, sentiment

# specify Stanford Dependencies format for backwards compatibility
# (new default is Universal Dependencies in 3.5.2)
Expand Down