Skip to content

Sentiment using server implementation #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Sentiment using server implementation
  • Loading branch information
vivekanand1101 committed Aug 12, 2015
commit 68862ab664c26a99938e409c98c9f4f803fc0487
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