Skip to content
Snippets Groups Projects
Commit 6812b516 authored by blunck's avatar blunck
Browse files

Bug fix

parent d3214d00
No related branches found
No related tags found
No related merge requests found
......@@ -49,10 +49,9 @@ def extract(corpus_instance):
sent_verb = analyser.polarity_scores(verb)['compound']
sent_situation = analyser.polarity_scores(situation)['compound']
if (sent_verb > 0.0 and sent_situation < 0.0) or (sent_verb < 0.0 and sent_situation > 0.0):
print("phrase: {} {} sent verb: {} sent situation: {}".format(verb, situation, sent_verb, sent_situation))
#if (sent_verb > 0.0 and sent_situation < 0.0) or (sent_verb < 0.0 and sent_situation > 0.0):
print("phrase: {} {} sent verb: {} sent situation: {}".format(verb, situation, sent_verb, sent_situation))
if __name__ == '__main__':
corpus = corpus.read_corpus("corpus_shuffled.csv")[:1000]
......
......@@ -15,7 +15,7 @@ def extract(corpus_instance, corpus_dict_key, vocabulary):
return vector.toarray()[0]
def get_vocabulary(corpus, corpus_dict_key, n):
def get_vocabulary(corpus, corpus_dict_key, n_range):
"""
Creates vocabulary based on given corpus.
"""
......@@ -23,7 +23,7 @@ def get_vocabulary(corpus, corpus_dict_key, n):
for line in corpus:
all_reviews.append(line[corpus_dict_key])
vectorizer = CountVectorizer(ngram_range=(n, n))
vectorizer = CountVectorizer(ngram_range=n_range)
vectorizer.fit(all_reviews)
return vectorizer.vocabulary_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment