Skip to content

Commit

Permalink
Merge pull request #65 from zengliangju/patch-2
Browse files Browse the repository at this point in the history
Update __init__.py
  • Loading branch information
isnowfy authored May 19, 2017
2 parents efc19ba + 9bf2a7e commit 8c2cc92
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions snownlp/sentiment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ def classify(self, sent):


def train(neg_file, pos_file):
neg_docs = codecs.open(neg_file, 'r', 'utf-8').readlines()
pos_docs = codecs.open(pos_file, 'r', 'utf-8').readlines()
neg = codecs.open(neg_file, 'r', 'utf-8').readlines()
pos = codecs.open(pos_file, 'r', 'utf-8').readlines()
neg_docs = []
pos_docs = []
for line in neg:
neg_docs.append(line.rstrip("\r\n"))
for line in pos:
pos_docs.append(line.rstrip("\r\n"))
global classifier
classifier = Sentiment()
classifier.train(neg_docs, pos_docs)
Expand Down

0 comments on commit 8c2cc92

Please sign in to comment.