Skip to content

Commit

Permalink
2nd version of obidroid
Browse files Browse the repository at this point in the history
  • Loading branch information
seekshreyas committed May 2, 2014
1 parent 93b3fd6 commit 38975a6
Show file tree
Hide file tree
Showing 2 changed files with 863 additions and 12 deletions.
24 changes: 12 additions & 12 deletions obidroidMR.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from mrjob.job import MRJob
from sentClassifier import sentClassify
from cPickle import load
# from sentClassifier import sentClassify
# from cPickle import load
import re
import nltk
# import nltk
from textblob import TextBlob
from textblob.sentiments import NaiveBayesAnalyzer
# from textblob.sentiments import NaiveBayesAnalyzer



Expand Down Expand Up @@ -36,20 +36,20 @@ def getFeatures(rev):

revAdjCount = 0

revPosTokens = nltk.pos_tag(nltk.word_tokenize(rev))
# revPosTokens = nltk.pos_tag(nltk.word_tokenize(rev))

for _, pos in revPosTokens:
if pos == 'JJ' or pos == 'VBP':
revAdjCount += 1
# for _, pos in revPosTokens:
# if pos == 'JJ' or pos == 'VBP':
# revAdjCount += 1


## Sentiment Classifiers:
revSentAgg = sentClassify(rev)
# revSentAgg = sentClassify(rev)
## overall production sentiment classifier
blob = TextBlob(rev, analyzer=NaiveBayesAnalyzer())
blobSent = blob.sentiment

# print blobSent
print blobSent

if blobSent[0] == 'pos':
revSent = 1 * blobSent[1]
Expand All @@ -67,8 +67,8 @@ def getFeatures(rev):
revUniqueWordLength,
revCapCount,
revExclaimCount,
revAdjCount,
revSentAgg,
# revAdjCount
# revSentAgg,
revSent
]

Expand Down
Loading

0 comments on commit 38975a6

Please sign in to comment.