(via these docs) | 10-06-19
from nltk.classify import NaiveBayesClassifier
from nltk.corpus import subjectivity
from nltk.sentiment import SentimentAnalyzer
from nltk.sentiment.util import *
subjective
and objective
sentences from the nltk for practice¶n_instances = 100
subj_docs = [(sent, 'subj') for sent in subjectivity.sents(categories='subj')[:n_instances]]
obj_docs = [(sent, 'obj') for sent in subjectivity.sents(categories='obj')[:n_instances]]
test
and train
for both subj
and obj
¶train_subj_docs = subj_docs[:80]
test_subj_docs = subj_docs[80:100]
train_obj_docs = obj_docs[:80]
test_obj_docs = obj_docs[80:100]
test
and train
sets¶training_docs = train_subj_docs + train_obj_docs
testing_docs = test_subj_docs + test_obj_docs
# training_docs
SentimentAnalyzer
to mark negation in training docs¶sentim_analyzer = SentimentAnalyzer()
# WTF IS MARK_NEGATION
all_words_neg = sentim_analyzer.all_words([mark_negation(doc) for doc in training_docs])
training_docs
[(['smart', 'and', 'alert', ',', 'thirteen', 'conversations', 'about', 'one', 'thing', 'is', 'a', 'small', 'gem', '.'], 'subj'), (['color', ',', 'musical', 'bounce', 'and', 'warm', 'seas', 'lapping', 'on', 'island', 'shores', '.', 'and', 'just', 'enough', 'science', 'to', 'send', 'you', 'home', 'thinking', '.'], 'subj'), (['it', 'is', 'not', 'a', 'mass-market', 'entertainment', 'but', 'an', 'uncompromising', 'attempt', 'by', 'one', 'artist', 'to', 'think', 'about', 'another', '.'], 'subj'), (['a', 'light-hearted', 'french', 'film', 'about', 'the', 'spiritual', 'quest', 'of', 'a', 'fashion', 'model', 'seeking', 'peace', 'of', 'mind', 'while', 'in', 'a', 'love', 'affair', 'with', 'a', 'veterinarian', 'who', 'is', 'a', 'non-practicing', 'jew', '.'], 'subj'), (['my', 'wife', 'is', 'an', 'actress', 'has', 'its', 'moments', 'in', 'looking', 'at', 'the', 'comic', 'effects', 'of', 'jealousy', '.', 'in', 'the', 'end', ',', 'though', ',', 'it', 'is', 'only', 'mildly', 'amusing', 'when', 'it', 'could', 'have', 'been', 'so', 'much', 'more', '.'], 'subj'), (['works', 'both', 'as', 'an', 'engaging', 'drama', 'and', 'an', 'incisive', 'look', 'at', 'the', 'difficulties', 'facing', 'native', 'americans', '.'], 'subj'), (['even', 'a', 'hardened', 'voyeur', 'would', 'require', 'the', 'patience', 'of', 'job', 'to', 'get', 'through', 'this', 'interminable', ',', 'shapeless', 'documentary', 'about', 'the', 'swinging', 'subculture', '.'], 'subj'), (['when', 'perry', 'fists', 'a', 'bull', 'at', 'the', 'moore', 'farm', ',', "it's", 'only', 'a', 'matter', 'of', 'time', 'before', 'he', 'gets', 'the', 'upper', 'hand', 'in', 'matters', 'of', 'the', 'heart', '.'], 'subj'), (['the', 'characters', '.', '.', '.', 'are', 'paper-thin', ',', 'and', 'their', 'personalities', 'undergo', 'radical', 'changes', 'when', 'it', 'suits', 'the', 'script', '.'], 'subj'), (['the', 'script', 'is', 'a', 'tired', 'one', ',', 'with', 'few', 'moments', 'of', 'joy', 'rising', 'above', 'the', 'stale', 'material', '.'], 'subj'), (['the', 'bland', 'outweighs', 'the', 'nifty', ',', 'and', 'cletis', 'tout', 'never', 'becomes', 'the', 'clever', 'crime', 'comedy', 'it', 'thinks', 'it', 'is', '.'], 'subj'), (['directed', 'by', 'david', 'twohy', 'with', 'the', 'same', 'great', 'eye', 'for', 'eerie', 'understatement', 'that', 'he', 'brought', 'to', 'pitch', 'black', '.'], 'subj'), (["it's", 'a', 'very', 'tasteful', 'rock', 'and', 'roll', 'movie', '.', 'you', 'could', 'put', 'it', 'on', 'a', 'coffee', 'table', 'anywhere', '.'], 'subj'), (['provides', 'the', 'kind', 'of', "'laugh", "therapy'", 'i', 'need', 'from', 'movie', 'comedies', '--', 'offbeat', 'humor', ',', 'amusing', 'characters', ',', 'and', 'a', 'happy', 'ending', '.', 'after', 'seeing', "'analyze", 'that', ',', "'", 'i', 'feel', 'better', 'already', '.'], 'subj'), (['worth', 'a', 'look', 'by', 'those', 'on', 'both', 'sides', 'of', 'the', 'issues', ',', 'if', 'only', 'for', 'the', 'perspective', 'it', 'offers', ',', 'one', 'the', 'public', 'rarely', 'sees', '.'], 'subj'), (['watching', 'the', 'film', 'is', 'like', 'reading', 'a', 'times', 'portrait', 'of', 'grief', 'that', 'keeps', 'shifting', 'focus', 'to', 'the', 'journalist', 'who', 'wrote', 'it', '.'], 'subj'), (['despite', 'these', 'annoyances', ',', 'the', 'capable', 'clayburgh', 'and', 'tambor', 'really', 'do', 'a', 'great', 'job', 'of', 'anchoring', 'the', 'characters', 'in', 'the', 'emotional', 'realities', 'of', 'middle', 'age', '.'], 'subj'), (["it's", 'a', 'good', 'thing', 'that', 'woolly', 'mammoths', 'are', 'extinct', ',', 'because', 'this', 'movie', 'will', 'have', 'every', 'kid', 'in', 'the', 'schoolyard', 'wishing', 'for', 'their', 'very', 'own', '.'], 'subj'), (['preposterous', 'and', 'tedious', ',', 'sonny', 'is', 'spiked', 'with', 'unintentional', 'laughter', 'that', ',', 'unfortunately', ',', 'occurs', 'too', 'infrequently', 'to', 'make', 'the', 'film', 'even', 'a', 'guilty', 'pleasure', '.'], 'subj'), (['4ever', 'has', 'the', 'same', 'sledgehammer', 'appeal', 'as', 'pokemon', 'videos', ',', 'but', 'it', 'breathes', 'more', 'on', 'the', 'big', 'screen', 'and', 'induces', 'headaches', 'more', 'slowly', '.'], 'subj'), (['si', 'el', 'siglo', 'xxi', 'necesita', 'de', 'héroes', ',', 'el', 'hombre', 'araña', 'parece', 'haber', 'llegado', 'para', 'quedarse', '.'], 'subj'), (["it's", 'hard', 'to', 'tell', 'with', 'all', 'the', 'crashing', 'and', 'banging', 'where', 'the', 'salesmanship', 'ends', 'and', 'the', 'movie', 'begins', '.'], 'subj'), (['it', 'desperately', 'wants', 'to', 'be', 'a', 'wacky', ',', 'screwball', 'comedy', ',', 'but', 'the', 'most', 'screwy', 'thing', 'here', 'is', 'how', 'so', 'many', 'talented', 'people', 'were', 'convinced', 'to', 'waste', 'their', 'time', '.'], 'subj'), (['writer/director', 'walter', 'hill', 'is', 'in', 'his', 'hypermasculine', 'element', 'here', ',', 'once', 'again', 'able', 'to', 'inject', 'some', 'real', 'vitality', 'and', 'even', 'art', 'into', 'a', 'pulpy', 'concept', 'that', ',', 'in', 'many', 'other', 'hands', 'would', 'be', 'completely', 'forgettable', '.'], 'subj'), (['hill', 'looks', 'to', 'be', 'going', 'through', 'the', 'motions', ',', 'beginning', 'with', 'the', 'pale', 'script', '.'], 'subj'), (['extremely', 'well', 'cast', ',', 'especially', 'in', 'the', 'large', 'number', 'of', 'supporting', 'roles', '.'], 'subj'), (['a', 'chilling', 'tale', 'of', 'one', 'of', 'the', 'great', 'crimes', 'of', '20th', 'century', 'france', ':', 'the', 'murder', 'of', 'two', 'rich', 'women', 'by', 'their', 'servants', 'in', '1933', '.'], 'subj'), (['a', 'dark', ',', 'quirky', 'road', 'movie', 'that', 'constantly', 'defies', 'expectation', '.'], 'subj'), (['impostor', "doesn't", 'do', 'much', 'with', 'its', 'template', ',', 'despite', 'a', 'remarkably', 'strong', 'cast', '.'], 'subj'), (['though', 'it', 'lacks', 'the', 'utter', 'authority', 'of', 'a', 'genre', 'gem', ',', "there's", 'a', 'certain', 'robustness', 'to', 'this', 'engaging', 'mix', 'of', 'love', 'and', 'bloodletting', '.'], 'subj'), (['if', 'you', 'can', 'keep', 'your', 'eyes', 'open', 'amid', 'all', 'the', 'blood', 'and', 'gore', ',', "you'll", 'see', 'del', 'toro', 'has', 'brought', 'unexpected', 'gravity', 'to', 'blade', 'ii', '.'], 'subj'), (["there's", 'undeniable', 'enjoyment', 'to', 'be', 'had', 'from', 'films', 'crammed', 'with', 'movie', 'references', ',', 'but', 'the', 'fun', 'wears', 'thin', '--', 'then', 'out', '--', 'when', "there's", 'nothing', 'else', 'happening', '.'], 'subj'), (['a', 'work', 'that', 'lacks', 'both', 'a', 'purpose', 'and', 'a', 'strong', 'pulse', '.'], 'subj'), (['it', 'helps', 'that', 'lil', 'bow', 'wow', '.', '.', '.', 'tones', 'down', 'his', 'pint-sized', 'gangsta', 'act', 'to', 'play', 'someone', 'who', 'resembles', 'a', 'real', 'kid', '.'], 'subj'), (['a', 'mimetic', 'approximation', 'of', 'better', 'films', 'like', 'contempt', 'and', '8', '1/2', '.'], 'subj'), (['eastwood', 'is', 'an', 'icon', 'of', 'moviemaking', ',', 'one', 'of', 'the', 'best', 'actors', ',', 'directors', 'and', 'producers', 'around', ',', 'responsible', 'for', 'some', 'excellent', 'work', '.', 'but', 'even', 'a', 'hero', 'can', 'stumble', 'sometimes', '.'], 'subj'), (['nair', "doesn't", 'use', '[monsoon', 'wedding]', 'to', 'lament', 'the', 'loss', 'of', 'culture', '.', 'instead', ',', 'she', 'sees', 'it', 'as', 'a', 'chance', 'to', 'revitalize', 'what', 'is', 'and', 'always', 'has', 'been', 'remarkable', 'about', 'clung-to', 'traditions', '.'], 'subj'), (['stuffed', 'to', 'the', 'brim', 'with', 'ideas', ',', 'american', 'instigator', 'michael', "moore's", 'film', 'is', 'a', 'rambling', 'examination', 'of', 'american', 'gun', 'culture', 'that', 'uses', 'his', 'usual', 'modus', 'operandi', 'of', 'crucifixion', 'through', 'juxtaposition', '.'], 'subj'), (['.', '.', '.', 'a', 'joke', 'at', 'once', 'flaky', 'and', 'resonant', ',', 'lightweight', 'and', 'bizarrely', 'original', '.'], 'subj'), (["fontaine's", 'direction', ',', 'especially', 'her', 'agreeably', 'startling', 'use', 'of', 'close-ups', 'and', 'her', 'grace', 'with', 'a', 'moving', 'camera', ',', 'creates', 'sheerly', 'cinematic', 'appeal', '.'], 'subj'), (['starts', 'slowly', ',', 'but', 'adrien', 'brody', 'Â\x96', 'in', 'the', 'title', 'role', 'Â\x96', 'helps', 'make', 'the', "film's", 'conclusion', 'powerful', 'and', 'satisfying', '.'], 'subj'), (['a', 'refreshing', 'change', 'from', 'the', 'usual', 'whoopee-cushion', 'effort', 'aimed', 'at', 'the', 'youth', 'market', '.'], 'subj'), (['you', 'really', 'have', 'to', 'salute', 'writer-director', 'haneke', '(', 'he', 'adapted', 'elfriede', "jelinek's", 'novel', ')', 'for', 'making', 'a', 'film', 'that', "isn't", 'nearly', 'as', 'graphic', 'but', 'much', 'more', 'powerful', ',', 'brutally', 'shocking', 'and', 'difficult', 'to', 'watch', '.'], 'subj'), (['barry', 'convinces', 'us', "he's", 'a', 'dangerous', ',', 'secretly', 'unhinged', 'guy', 'who', 'could', 'easily', 'have', 'killed', 'a', 'president', 'because', 'it', 'made', 'him', 'feel', 'powerful', '.'], 'subj'), (['a', 'distant', ',', 'even', 'sterile', ',', 'yet', 'compulsively', 'watchable', 'look', 'at', 'the', 'sordid', 'life', 'of', "hogan's", 'heroes', 'star', 'bob', 'crane', '.'], 'subj'), (["there's", 'no', 'disguising', 'this', 'as', 'one', 'of', 'the', 'worst', 'films', 'of', 'the', 'summer', '.', 'or', 'for', 'the', 'year', ',', 'for', 'that', 'matter', '.'], 'subj'), (['director', 'dan', 'verete', 'uses', 'his', 'camera', 'as', 'the', 'metaphoric', 'needle', ',', 'and', 'his', 'cast', 'in', 'each', 'segment', 'as', 'his', 'thread', ',', 'to', 'form', 'a', 'sweeping', 'tapestry', 'of', 'mis-explanation', 'and', 'contention', '.'], 'subj'), (['waydowntown', 'just', 'like', 'most', 'large', 'cities', ',', "isn't", 'somewhere', "you'll", 'want', 'to', 'spend', 'the', 'rest', 'of', 'your', 'life', ',', 'but', 'it', 'sure', 'is', 'a', 'fun', 'place', 'to', 'visit', 'for', 'a', 'while', '.'], 'subj'), (['the', 'acting', 'in', 'pauline', 'and', 'paulette', 'is', 'good', 'all', 'round', ',', 'but', 'what', 'really', 'sets', 'the', 'film', 'apart', 'is', "debrauwer's", 'refusal', 'to', 'push', 'the', 'easy', 'emotional', 'buttons', '.'], 'subj'), (['the', 'only', 'young', 'people', 'who', 'possibly', 'will', 'enjoy', 'it', 'are', 'infants', '.', '.', '.', 'who', 'might', 'be', 'distracted', 'by', 'the', "movie's", 'quick', 'movements', 'and', 'sounds', '.'], 'subj'), (["there's", 'lots', 'of', 'cool', 'stuff', 'packed', 'into', "espn's", 'ultimate', 'x', '.'], 'subj'), (['it', 'gets', 'old', 'quickly', '.', 'watch', 'barbershop', 'again', 'if', "you're", 'in', 'need', 'of', 'a', 'cube', 'fix--this', "isn't", 'worth', 'sitting', 'through', '.'], 'subj'), (['harland', 'williams', 'is', 'so', 'funny', 'in', 'drag', 'he', 'should', 'consider', 'permanent', 'sex-reassignment', '.'], 'subj'), (['the', "film's", 'images', 'give', 'a', 'backbone', 'to', 'the', 'company', 'and', 'provide', 'an', 'emotional', 'edge', 'to', 'its', 'ultimate', 'demise', '.'], 'subj'), (["it's", 'the', 'kind', 'of', 'film', 'where', 'the', 'villain', 'even', 'gives', 'an', 'evil', 'look', 'for', 'his', 'passport', 'photo', '.', 'how', 'can', 'you', 'resist', 'that', '?'], 'subj'), (['plotless', 'collection', 'of', 'moronic', 'stunts', 'is', 'by', 'far', 'the', 'worst', 'movie', 'of', 'the', 'year', '.'], 'subj'), (['a', 'broad', ',', 'melodramatic', 'estrogen', 'opera', "that's", 'pretty', 'toxic', 'in', 'its', 'own', 'right', '.'], 'subj'), (['just', 'a', 'kiss', 'wants', 'desperately', 'to', 'come', 'off', 'as', 'a', 'fanciful', 'film', 'about', 'the', 'typical', 'problems', 'of', 'average', 'people', '.', 'but', 'it', 'is', 'set', 'in', 'a', 'world', 'that', 'is', 'very', ',', 'very', 'far', 'from', 'the', 'one', 'most', 'of', 'us', 'inhabit', '.'], 'subj'), (['this', 'is', 'a', 'movie', 'where', 'the', 'most', 'notable', 'observation', 'is', 'how', 'long', "you've", 'been', 'sitting', 'still', '.'], 'subj'), (['with', 'a', 'romantic', 'comedy', 'plotline', 'straight', 'from', 'the', 'ages', ',', 'this', 'cinderella', 'story', "doesn't", 'have', 'a', 'single', 'surprise', 'up', 'its', 'sleeve', '.', 'but', 'it', 'does', 'somehow', 'manage', 'to', 'get', 'you', 'under', 'its', 'spell', '.'], 'subj'), (['a', 'charming', 'trifle', '.', '.', '.', 'a', 'welcome', 'return', 'to', 'jocular', 'form', '.'], 'subj'), (["it's", 'not', 'difficult', 'to', 'spot', 'the', 'culprit', 'early-on', 'in', 'this', 'predictable', 'thriller', '.'], 'subj'), (['without', 'the', 'dark', 'spookiness', 'of', 'crystal', 'lake', 'camp', ',', 'the', 'horror', 'concept', 'completely', 'loses', 'its', 'creepy', 'menace', '.'], 'subj'), (["there's", 'suspension', 'of', 'disbelief', 'and', 'then', "there's", 'bad', 'screenwriting', '.', '.', '.', 'this', 'film', 'packs', 'a', 'wallop', 'of', 'the', 'latter', '.'], 'subj'), (['little', 'more', 'than', 'a', 'stylish', 'exercise', 'in', 'revisionism', 'whose', 'point', '.', '.', '.', 'is', 'no', 'doubt', 'true', ',', 'but', 'serves', 'as', 'a', 'rather', 'thin', 'moral', 'to', 'such', 'a', 'knowing', 'fable', '.'], 'subj'), (['anyone', 'who', 'can', 'count', 'to', 'five', '(', 'the', "film's", 'target', 'market', '?', ')', 'can', 'see', 'where', 'this', 'dumbed-down', 'concoction', 'is', 'going', '.'], 'subj'), (['every', 'defiantly', 'over-the-top', 'action', 'scene', '--', 'from', 'high-stakes', 'car', 'chases', 'to', 'fearsome', 'drug', 'busts', '--', 'seizes', 'your', 'adrenal', 'gland', 'and', 'milks', 'it', 'like', 'an', 'epileptic', 'farmer', '.'], 'subj'), (['kosminsky', '.', '.', '.', 'puts', 'enough', 'salt', 'into', 'the', 'wounds', 'of', 'the', 'tortured', 'and', 'self-conscious', 'material', 'to', 'make', 'it', 'sting', '.'], 'subj'), (['a', 'sobering', 'and', 'powerful', 'documentary', 'about', 'the', 'most', 'severe', 'kind', 'of', 'personal', 'loss', ':', 'rejection', 'by', "one's", 'mother', '.'], 'subj'), (['if', 'the', 'story', 'lacks', 'bite', ',', 'the', 'performances', 'are', 'never', 'less', 'than', 'affectionate', '.'], 'subj'), (['a', 'deftly', 'entertaining', 'film', ',', 'smartly', 'played', 'and', 'smartly', 'directed', '.'], 'subj'), (['ice', 'age', 'is', 'the', 'first', 'computer-generated', 'feature', 'cartoon', 'to', 'feel', 'like', 'other', 'movies', ',', 'and', 'that', 'makes', 'for', 'some', 'glacial', 'pacing', 'early', 'on', '.'], 'subj'), (['i', 'like', 'my', 'christmas', 'movies', 'with', 'more', 'elves', 'and', 'snow', 'and', 'less', 'pimps', 'and', "ho's", '.'], 'subj'), (["ferrara's", 'strongest', 'and', 'most', 'touching', 'movie', 'of', 'recent', 'years', '.'], 'subj'), (['skip', 'work', 'to', 'see', 'it', 'at', 'the', 'first', 'opportunity', '.'], 'subj'), (['both', 'the', 'film', 'and', "nachtwey's", 'photos', 'hammer', 'home', 'the', 'grim', 'reality', 'of', 'the', "world's", 'gutters', 'and', 'battlefields', ',', 'and', 'will', 'make', 'you', 'question', 'what', "'news'", 'really', 'is', '.'], 'subj'), (['so', 'relentlessly', 'wholesome', 'it', 'made', 'me', 'want', 'to', 'swipe', 'something', '.'], 'subj'), (['shyamalan', 'offers', 'copious', 'hints', 'along', 'the', 'way', '--', 'myriad', 'signs', ',', 'if', 'you', 'will', '--', 'that', 'beneath', 'the', 'familiar', ',', 'funny', 'surface', 'is', 'a', 'far', 'bigger', ',', 'far', 'more', 'meaningful', 'story', 'than', 'one', 'in', 'which', 'little', 'green', 'men', 'come', 'to', 'earth', 'for', 'harvesting', 'purposes', '.'], 'subj'), (['that', "'alabama'", 'manages', 'to', 'be', 'pleasant', 'in', 'spite', 'of', 'its', 'predictability', 'and', 'occasional', 'slowness', 'is', 'due', 'primarily', 'to', 'the', 'perkiness', 'of', 'witherspoon', '(', 'who', 'is', 'always', 'a', 'joy', 'to', 'watch', ',', 'even', 'when', 'her', 'material', 'is', 'not', 'first-rate', ')', '.', '.', '.'], 'subj'), (['against', 'all', 'odds', 'in', 'heaven', 'and', 'hell', ',', 'it', 'creeped', 'me', 'out', 'just', 'fine', '.'], 'subj'), (['the', 'movie', 'begins', 'in', 'the', 'past', 'where', 'a', 'young', 'boy', 'named', 'sam', 'attempts', 'to', 'save', 'celebi', 'from', 'a', 'hunter', '.'], 'obj'), (['emerging', 'from', 'the', 'human', 'psyche', 'and', 'showing', 'characteristics', 'of', 'abstract', 'expressionism', ',', 'minimalism', 'and', 'russian', 'constructivism', ',', 'graffiti', 'removal', 'has', 'secured', 'its', 'place', 'in', 'the', 'history', 'of', 'modern', 'art', 'while', 'being', 'created', 'by', 'artists', 'who', 'are', 'unconscious', 'of', 'their', 'artistic', 'achievements', '.'], 'obj'), (['spurning', 'her', "mother's", 'insistence', 'that', 'she', 'get', 'on', 'with', 'her', 'life', ',', 'mary', 'is', 'thrown', 'out', 'of', 'the', 'house', ',', 'rejected', 'by', 'joe', ',', 'and', 'expelled', 'from', 'school', 'as', 'she', 'grows', 'larger', 'with', 'child', '.'], 'obj'), (['amitabh', "can't", 'believe', 'the', 'board', 'of', 'directors', 'and', 'his', 'mind', 'is', 'filled', 'with', 'revenge', 'and', 'what', 'better', 'revenge', 'than', 'robbing', 'the', 'bank', 'himself', ',', 'ironic', 'as', 'it', 'may', 'sound', '.'], 'obj'), (['she', ',', 'among', 'others', 'excentricities', ',', 'talks', 'to', 'a', 'small', 'rock', ',', 'gertrude', ',', 'like', 'if', 'she', 'was', 'alive', '.'], 'obj'), (['this', 'gives', 'the', 'girls', 'a', 'fair', 'chance', 'of', 'pulling', 'the', 'wool', 'over', 'their', 'eyes', 'using', 'their', 'sexiness', 'to', 'poach', 'any', 'last', 'vestige', 'of', 'common', 'sense', 'the', 'dons', 'might', 'have', 'had', '.'], 'obj'), (['styled', 'after', "vh1's", '"', 'behind', 'the', 'music', ',', '"', 'this', 'mockumentary', 'profiles', 'the', 'rise', 'and', 'fall', 'of', 'an', 'internet', 'startup', ',', 'called', 'icevan', '.', 'com', '.'], 'obj'), (['being', 'blue', 'is', 'not', 'his', 'only', 'predicament', ';', 'he', 'also', 'lacks', 'the', 'ability', 'to', 'outwardly', 'express', 'his', 'emotions', '.'], 'obj'), (['the', "killer's", 'clues', 'are', 'a', 'perversion', 'of', 'biblical', 'punishments', 'for', 'sins', ':', 'stoning', ',', 'burning', ',', 'decapitation', '.'], 'obj'), (['david', 'is', 'a', 'painter', 'with', "painter's", 'block', 'who', 'takes', 'a', 'job', 'as', 'a', 'waiter', 'to', 'get', 'some', 'inspiration', '.'], 'obj'), (['women', 'craved', 'him', 'and', 'men', 'wanted', 'to', 'be', 'him', '.'], 'obj'), (['set', 'on', 'an', 'island', 'off', 'the', 'coast', 'of', 'florida', ',', 'a', 'techno', 'rave', 'party', 'attracts', 'a', 'diverse', 'group', 'of', 'college', 'coeds', 'and', 'a', 'coast', 'guard', 'officer', '.'], 'obj'), (['lesson', 'to', 'be', 'learned', ':', 'never', ',', 'never', 'mess', 'with', '"', 'the', 'gay', 'mafia', '!', '"'], 'obj'), (['the', 'theme', 'of', 'the', 'film', 'simultaneously', 'addresses', 'the', 'similarities', 'between', 'the', 'two', 'factions', 'of', 'law', 'and', 'crime', 'while', 'revealing', 'the', 'similarities', 'between', 'the', 'two', 'brothers', '.'], 'obj'), (["they're", 'jewish', ',', "they're", 'grandmothers', ',', 'and', "they're", 'lesbians', '.'], 'obj'), (['but', "he's", 'neglecting', 'his', 'work', ',', 'carping', 'at', 'his', 'mom', ',', 'and', 'behaving', 'badly', 'toward', 'his', 'loyal', 'friend', 'bobbi', '.'], 'obj'), (['with', 'all', 'this', 'going', 'on', ',', "gerry's", 'estranged', 'wife', 'margaret', 'is', 'worried', 'for', 'her', "daughter's", 'safety', 'and', 'finds', 'herself', 'another', 'target', 'in', 'the', 'race', 'to', 'find', 'the', 'code', '.'], 'obj'), (['valento', 'feels', 'the', 'heat', 'and', 'turns', 'the', 'table', ':', 'he', 'makes', 'the', 'dupe', 'into', 'one', 'of', 'his', 'own', 'and', 'rubs', 'the', "da's", 'nose', 'in', 'it', '.'], 'obj'), (['saigon', ',', '1952', ',', 'a', 'beautiful', ',', 'exotic', ',', 'and', 'mysterious', 'city', 'caught', 'in', 'the', 'grips', 'of', 'the', 'vietnamese', 'war', 'of', 'liberation', 'from', 'the', 'french', 'colonial', 'powers', '.'], 'obj'), (['deep', 'in', 'the', 'northwest', ',', 'there', 'is', 'a', 'lone', 'ranch', 'tucked', 'away', 'so', 'purposefully', ',', 'the', 'only', 'way', 'to', 'find', 'it', 'is', 'by', 'not', 'looking', '.'], 'obj'), (['as', 'a', 'young', 'teenager', ',', 'he', 'finds', 'out', 'who', 'his', 'father', 'is', '.'], 'obj'), (['in', 'life', ',', "there's", 'silver', ',', 'and', "there's", 'lead', ',', 'says', 'rikki', 'ortega', ',', 'as', 'he', 'moves', 'to', 'be', 'king', 'of', 'the', 'street', 'in', '"', 'Á', ';', 'nglio', ',', '"', 'l', '.', 'a', '.', "'s", 'east', 'side', '.'], 'obj'), (['all', 'these', 'games', 'of', 'chasing', ',', 'rejecting', 'and', 'seducing', 'are', 'played', 'out', 'in', 'an', 'economically', 'and', 'spiritually', 'depressed', 'hong', 'kong', ',', 'without', 'much', 'gusto', '.'], 'obj'), (['television', 'made', 'him', 'famous', ',', 'but', 'his', 'biggest', 'hits', 'happened', 'off', 'screen', '.'], 'obj'), (['jordan', 'is', 'a', 'mom', 'who', 'is', 'on', 'a', 'life', 'long', 'search', 'for', 'true', 'faith', 'as', 'she', 'tries', 'to', 'protect', 'her', 'only', 'child', 'from', 'what', 'she', 'believes', 'is', 'injustice', '.'], 'obj'), (["'bloody", "magic'", 'is', 'the', 'story', 'of', 'zack', ',', 'an', 'eleven', 'year', 'old', 'school', 'boy', ',', "who's", 'family', 'is', 'visited', 'by', 'three', 'debt', 'collectors', '.'], 'obj'), (['however', ',', 'jane', ',', "wendy's", '12-year-old', 'daughter', ',', 'sees', 'it', 'all', 'as', 'make', 'believe', 'and', 'refuses', 'to', 'believe', 'in', 'the', 'tales', '.'], 'obj'), (['called', '"', 'an', 'elegant', 'documentary', '"', 'by', 'sundance', 'and', '"', 'eloquent', 'and', 'deeply', 'moving', '"', 'by', 'the', 'la', 'times', ',', 'toyo', 'miyatake', ':', 'infinite', 'shades', 'of', 'gray', 'is', 'a', 'penetrating', 'portrait', 'of', 'this', "photographer's", 'search', 'for', 'truth', 'and', 'beauty', 'in', 'a', 'world', 'of', 'impermanence', '.'], 'obj'), (['straight', 'up', ':', 'helicopters', 'in', 'action', 'will', 'take', 'audiences', 'on', 'a', 'series', 'of', 'aerial', 'adventures', '.'], 'obj'), (['a', 'lapp', 'woman', 'anni', 'gives', 'a', 'shelter', 'to', 'both', 'of', 'them', 'at', 'her', 'farm', '.'], 'obj'), (['it', 'also', 'touches', 'on', 'the', 'encroachment', 'of', 'christianity', 'brought', 'by', 'the', 'missionaries', ',', 'which', 'is', 'at', 'odds', 'with', "mepe's", 'tribal', 'and', 'traditional', 'roots', '.'], 'obj'), (['a', 'set', 'of', 'grisly', 'murders', 'brings', 'fbi', 'agent', 'will', 'graham', '(', 'norton', ')', 'out', 'of', 'retirement', 'and', 'puts', 'him', 'in', 'search', 'of', 'an', 'atrocious', 'killer', '(', 'fiennes', ')', "who's", 'driven', 'by', 'the', 'image', 'of', 'a', 'painting', '.'], 'obj'), (['soon', ',', 'the', 'team', 'begins', 'to', 'suspect', 'that', "knowles'", 'main', 'objective', 'is', 'actually', 'to', 'recover', 'the', 'prototype', 'of', 'a', 'dna', 'testing', 'machine', 'called', 'the', 'huxley', 'project', ',', 'which', 'his', 'company', 'has', 'spent', 'years', 'and', 'millions', 'of', 'dollars', 'developing', '.'], 'obj'), (['his', 'mother', 'persuades', 'a', 'renowned', 'entomologist', 'to', 'take', 'them', 'on', 'a', 'trip', 'to', 'the', 'jungle', 'to', 'search', 'for', 'the', 'butterfly', ',', 'leading', 'to', 'an', 'adventure', 'that', 'will', 'transform', 'their', 'lives', '.'], 'obj'), (['with', 'a', 'rare', 'gift', 'for', 'melding', 'subjectivity', 'with', 'biographical', 'facts', ',', 'má', ';', 'rton', 'brings', 'sabina', 'spielrein', 'back', 'to', 'life', ',', 'body', 'and', 'soul', '.'], 'obj'), (['seeking', 'a', 'mental', 'escape', ',', 'simone', 'begins', 'to', 'tune', 'into', "what's", 'happening', 'with', 'the', 'other', 'couples', 'around', 'her', '.'], 'obj'), (['the', 'beatle', 'fan', 'is', 'a', 'drama', 'about', 'albert', ',', 'a', 'psychotic', 'prisoner', 'who', 'is', 'a', 'devoted', 'fan', 'of', 'john', 'lennon', 'and', 'the', 'beatles', '.'], 'obj'), (['then', ',', 'in', '1974', ',', 'something', 'incredible', 'happened', '-', 'they', 'fell', 'in', 'love', '.'], 'obj'), (['on', 'her', 'deathbed', ',', 'candice', 'klein', 'accidentally', 'asks', 'the', 'question', ',', '"', 'what', 'did', 'i', 'ever', 'do', 'to', 'deserve', 'this', '?', '"'], 'obj'), (['shot', 'as', 'a', '"', 'behind-the-scenes', '"', 'look', 'at', 'how', 'a', 'fictional', 'kung-fu', 'movie', 'is', 'made', ',', 'the', 'film', 'is', 'basically', 'a', 'movie', 'about', 'the', 'making', 'of', 'a', 'movie', '.'], 'obj'), (['before', 'the', 'investigation', 'ends', ',', "we've", 'met', 'boyfriends', ',', 'a', 'drug', 'dealer', ',', "alicia's", 'mom', ',', "hadley's", 'dad', ',', 'nurses', ',', 'doctors', ',', 'and', 'an', 'orderly', '.'], 'obj'), (['but', 'what', 'exactly', 'is', 'good', '&', ';', 'what', 'exactly', 'is', 'evil', '?'], 'obj'), (['the', 'movie', 'takes', 'place', 'in', 'mexico', ',', '2002', '(', 'based', 'on', 'a', 'story', 'from', 'the', "1800's", ')', '.'], 'obj'), (["rainone's", 'love', 'affair', 'with', 'singing', 'sensation', 'kelly', 'mcguire', 'whom', 'he', 'discovered', 'and', 'his', 'near', 'demise', 'by', 'the', 'hands', 'of', 'his', 'own', 'proté', ';', 'gé', ';', 'vincent', 'riccola', 'is', 'the', 'juice', 'that', 'fuels', 'this', 'roller', 'coaster', 'ride', 'through', 'two', 'debauchery-filled', 'decades', 'of', 'greed', ',', 'sex', ',', 'drugs', 'and', 'rock', 'and', 'roll', '.'], 'obj'), (['trapped', 'in', 'a', 'lovers', 'triangle', 'and', 'ruthless', 'game', 'of', 'lust', ',', 'greed', ',', 'and', 'betrayal', 'we', 'follow', 'one', "woman's", 'hypnotic', 'journey', 'to', 'discover', 'her', 'true', 'self', '.', '.', '.'], 'obj'), (['decent-but-dull', 'dek', 'loves', 'shirley', ',', 'so', 'much', 'so', 'that', 'he', 'humiliates', 'her', 'by', 'proposing', 'without', 'warning', 'on', 'national', 'television', '.'], 'obj'), (['since', 'all', 'her', 'architects', 'are', 'either', 'busy', 'otherwise', 'or', 'too', 'conservative', 'in', 'style', ',', 'this', 'ambivalent', 'honour', 'falls', 'to', 'numerobis', '.'], 'obj'), (["there's", 'a', 'story', 'that', 'goes', 'around', 'the', 'town', 'of', 'darkness', 'falls', 'about', 'her', ',', 'and', "she's", 'called', 'the', 'tooth', 'fairy', '.'], 'obj'), (['a', 'strange', 'film', 'employing', 'old', 'home', 'movies', 'and', 'newly', 'shot', 'footage', 'in', 'an', 'effort', 'to', 'expose', 'one', 'hungarian', 'family', 'and', 'their', 'mutiple', 'problems', 'from', 'the', '1940s', 'to', 'current', '.'], 'obj'), (['matsumoto', 'and', 'sawako', 'were', 'a', 'happy', 'couple', ',', 'but', 'meddling', 'parents', 'and', 'chase', 'for', 'success', 'push', 'the', 'boy', 'to', 'a', 'tragic', 'choice', '.'], 'obj'), (['elvis', 'teams', 'up', 'with', 'jack', '(', 'ossie', 'davis', ')', ',', 'a', 'fellow', 'nursing', 'home', 'resident', 'who', 'thinks', 'that', 'he', 'is', 'actually', 'president', 'john', 'f', '.', 'kennedy', ',', 'and', 'the', 'two', 'valiant', 'old', 'codgers', 'sally', 'forth', 'to', 'battle', 'an', 'evil', 'egyptian', 'entity', 'who', 'has', 'chosen', 'their', 'long-term', 'care', 'facility', 'as', 'his', 'happy', 'hunting', 'grounds', '.'], 'obj'), (['everywhere', 'he', 'goes', 'he', 'is', 'plagued', 'by', 'cats', 'and', 'when', 'by', 'chance', 'he', 'meets', 'carol', 'on', 'a', 'lonely', 'highway', 'they', 'must', 'begin', 'a', 'journey', ',', 'avoiding', 'the', 'mysterious', 'private', 'detective', 'mr', 'barlow', 'and', 'the', 'terrifying', 'inhuman', 'creature', 'jack', ',', 'to', 'uncover', 'the', 'dark', 'truth', 'to', "charlie's", 'life', '.'], 'obj'), (['used', 'to', 'living', 'in', 'poverty', ',', 'it', 'seemed', 'impossible', 'for', 'cass', 'and', 'cary', 'to', 'have', 'a', 'comfortable', 'and', 'bountiful', 'life', 'until', 'doqa', 'gracia', 'comes', 'to', 'bring', 'them', 'into', 'her', 'home', '.'], 'obj'), (['the', 'story', 'of', 'a', 'normal', 'family', 'in', 'which', 'come', 'out', 'the', 'dreams', 'of', 'those', 'who', 'have', 'lost', 'their', 'possibilities', 'and', 'of', 'those', 'who', 'want', 'to', 'realize', 'them', '.'], 'obj'), (['with', 'grit', 'and', 'determination', 'molly', 'guides', 'the', 'girls', 'on', 'an', 'epic', 'journey', ',', 'one', 'step', 'ahead', 'of', 'the', 'authorities', ',', 'over', '1', ',', '500', 'miles', 'of', "australia's", 'outback', 'in', 'search', 'of', 'the', 'rabbit-proof', 'fence', 'that', 'bisects', 'the', 'continent', 'and', 'will', 'lead', 'them', 'home', '.'], 'obj'), (['they', 'nevertherless', 'feel', 'responsible', 'to', 'protect', 'the', 'flag', 'until', "monday's", 'ceremony', '.'], 'obj'), (['the', 'doctor', 'realizes', "it''s", 'a', 'love', 'virus', 'so', 'he', 'advises', 'him', 'to', 'woo', 'the', 'girl', 'somehow', ',', 'not', 'realizing', 'that', 'munnabhai', 'has', 'fallen', 'for', 'none', 'other', 'than', 'his', 'own', 'younger', 'sister', 'komal', '.'], 'obj'), (['however', ',', 'he', 'can', 'only', 'inhabit', 'the', 'body', 'of', 'a', 'child', 'for', 'a', 'short', 'time', '.'], 'obj'), (['years', 'later', ',', 'on', 'a', 'hunting', 'trip', 'in', 'the', 'maine', 'woods', ',', 'they', 'are', 'overtaken', 'by', 'a', 'blizzard', ',', 'a', 'vicious', 'storm', 'in', 'which', 'something', 'much', 'more', 'ominous', 'moves', '.'], 'obj'), (['consequently', ',', 'what', 'begins', 'as', 'an', 'enthusiastic', 'road', 'trip', 'is', 'soon', 'plagued', 'with', 'mysterious', 'roadside', 'obstacles', 'that', 'threaten', 'to', 'prevent', 'the', 'boys', 'from', 'ever', 'making', 'it', 'to', 'the', 'competition', '.'], 'obj'), (['when', 'she', 'gets', 'into', 'trouble', 'with', 'the', 'police', 'simon', 'represses', 'his', 'death', 'wish', 'and', 'decides', 'to', 'help', 'her', 'out', '.'], 'obj'), (['chon', 'then', 'travels', 'to', 'new', 'york', 'for', 'roy', "o'bannon", '(', 'owen', 'wilson', ')', '.'], 'obj'), (['not', 'only', 'must', 'they', 'overcome', 'an', 'enemy', 'adept', 'at', 'technological', 'witchery', ',', 'they', 'must', 'overcome', 'the', 'curse', 'that', 'marks', 'their', 'destiny', '.'], 'obj'), (['their', 'life', 'becomes', 'less', 'ordinary', 'when', 'they', 'encounter', 'herb', ',', 'a', 'mischievous', 'and', 'malevolent', 'geek', '.'], 'obj'), (['they', 'call', 'themselves', 'd', '.', 'e', '.', 'b', '.', 's', '.'], 'obj'), (['the', 'story', 'starts', 'with', 'hakimi', ',', 'a', 'freelance', 'scriptwriter', 'who', 'is', 'on', 'his', 'way', 'to', 'send', 'his', '7-year-old', 'daughter', ',', 'imelda', ',', 'to', 'his', "ex-wife's", 'house', 'on', 'one', 'stormy', 'night', '.'], 'obj'), (['they', 'follow', 'leads', ',', 'informants', 'turn', 'up', 'dead', ',', "nick's", 'wife', 'is', 'unhappy', "he's", 'back', 'on', 'the', 'street', ',', "henry's", 'protective', 'of', 'the', 'dead', "cop's", 'wife', '.'], 'obj'), (['the', 'second', 'part', 'of', 'aki', 'kaurismä', ';', "ki's", '"', 'finland', '"', 'trilogy', ',', 'the', 'film', 'follows', 'a', 'man', 'who', 'arrives', 'in', 'helsinki', 'and', 'gets', 'beaten', 'up', 'so', 'severely', 'he', 'develops', 'amnesia', '.'], 'obj'), (['soon', 'after', 'the', 'accident', ',', 'the', 'survivors', 'of', 'the', 'accident', 'start', 'dropping', 'like', 'flies', '.'], 'obj'), (['edgar', 'becomes', 'intent', 'on', 'laying', 'down', 'some', 'new', 'rules', 'and', 'turning', 'his', 'coddled', 'son', 'into', 'someone', 'who', 'can', 'take', 'on', 'the', 'family', 'farm', '.'], 'obj'), (['bound', 'by', 'a', 'long', 'red', 'cord', ',', 'a', 'young', 'couple', 'wanders', 'in', 'search', 'of', 'something', 'they', 'have', 'forgotten', '.'], 'obj'), (['sudden', 'fame', 'does', 'not', 'seem', 'to', 'solve', 'everything', ',', 'however', '.'], 'obj'), (['with', 'no', 'option', ',', 'joe', 'and', 'katsuragi', 'must', 'use', 'their', 'martial', 'arts', 'skills', 'to', 'fight', 'in', 'the', 'muscle', 'dome', '.'], 'obj'), (['drawing', 'from', 'his', 'time', 'with', 'the', 'kids', ',', 'he', 'writes', 'a', 'story', 'about', 'children', 'who', "don't", 'want', 'to', 'grow', 'up', '.'], 'obj'), (["she's", 'an', 'artist', ',', 'but', "hasn't", 'picked', 'up', 'a', 'brush', 'in', 'a', 'year', '.'], 'obj'), (['when', 'his', 'daughter', 'is', 'kidnapped', 'and', 'held', 'in', 'exchange', 'for', 'priceless', 'diamonds', ',', 'the', 'leader', 'of', 'a', 'crew', 'of', 'highly', 'skilled', 'urban', 'thieves', '(', 'dmx', ')', 'forges', 'an', 'unlikely', 'alliance', 'with', 'a', 'taiwanese', 'intelligence', 'officer', '(', 'jet', 'li', ')', 'to', 'rescue', 'her', '.'], 'obj'), (['"', 'garmento', '"', 'tells', 'the', 'other', 'side', 'of', 'the', 'story', ',', 'with', 'a', 'dark', 'and', 'satirical', 'look', 'at', 'new', "york's", 'wholesale', 'garment', 'industry', ',', 'where', 'shady', 'deals', 'are', 'made', 'for', 'a', 'buck', 'and', 'ruthlessness', 'is', 'a', 'prerequisite', 'for', 'career', 'success', '.'], 'obj'), (['rudy', 'yellowshirt', 'is', 'an', 'investigator', 'with', 'the', 'police', 'department', 'and', 'witnesses', 'firsthand', 'the', 'painful', 'legacy', 'of', 'indian', 'existence', '.'], 'obj'), (['journeying', 'from', 'the', 'vietnam', 'war', 'to', 'pulaski', ',', 'tennessee', 'and', 'back', 'to', 'vietnam', ',', 'daughter', 'from', 'danang', 'tensely', 'unfolds', 'as', 'cultural', 'differences', 'and', 'the', 'years', 'of', 'separation', 'take', 'their', 'toll', 'in', 'a', 'riveting', 'film', 'about', 'longing', 'and', 'the', 'personal', 'legacy', 'of', 'war', '.'], 'obj'), (['each', 'weekend', 'they', 'come', 'back', 'with', 'nothing', 'but', 'a', 'hangover', '.'], 'obj')]
all_words_neg[25:45]
['.', 'and', 'just', 'enough', 'science', 'to', 'send', 'you', 'home', 'thinking', '.', 'it', 'is', 'not', 'a_NEG', 'mass-market_NEG', 'entertainment_NEG', 'but_NEG', 'an_NEG', 'uncompromising_NEG']
This is one of many ways we can determine sentiment
unigram_word_feats
to get unigrams features¶unigram_feats = sentim_analyzer.unigram_word_feats(all_words_neg, min_freq=4)
len(unigram_feats)
83
sentim_analyzer.add_feat_extractor(extract_unigram_feats, unigrams=unigram_feats)
training_set = sentim_analyzer.apply_features(training_docs)
training_set[:1]
[({'contains(.)': True, 'contains(the)': False, 'contains(,)': True, 'contains(a)': True, 'contains(and)': True, 'contains(of)': False, 'contains(to)': False, 'contains(is)': True, 'contains(in)': False, 'contains(with)': False, 'contains(it)': False, 'contains(that)': False, 'contains(his)': False, 'contains(on)': False, 'contains(for)': False, 'contains(an)': False, 'contains(who)': False, 'contains(by)': False, 'contains(he)': False, 'contains(from)': False, 'contains(her)': False, 'contains(")': False, 'contains(film)': False, 'contains(as)': False, 'contains(this)': False, 'contains(movie)': False, 'contains(their)': False, 'contains(but)': False, 'contains(one)': True, 'contains(at)': False, 'contains(about)': True, 'contains(the_NEG)': False, 'contains(a_NEG)': False, 'contains(to_NEG)': False, 'contains(are)': False, "contains(there's)": False, 'contains(()': False, 'contains(story)': False, 'contains(when)': False, 'contains(so)': False, 'contains(be)': False, 'contains(,_NEG)': False, 'contains())': False, 'contains(they)': False, 'contains(you)': False, 'contains(not)': False, 'contains(have)': False, 'contains(like)': False, 'contains(will)': False, 'contains(all)': False, 'contains(into)': False, 'contains(out)': False, 'contains(she)': False, 'contains(what)': False, 'contains(life)': False, 'contains(has)': False, 'contains(its)': False, 'contains(only)': False, 'contains(more)': False, 'contains(even)': False, 'contains(--)': False, 'contains(:)': False, 'contains(can)': False, 'contains(;)': False, 'contains(home)': False, 'contains(look)': False, "contains(it's)": False, 'contains(if)': False, 'contains(where)': False, 'contains(most)': False, 'contains(him)': False, 'contains(search)': False, 'contains(but_NEG)': False, 'contains(love)': False, 'contains(both)': False, 'contains(make)': False, 'contains(begins)': False, 'contains(some)': False, 'contains(two)': False, 'contains(of_NEG)': False, 'contains(made)': False, 'contains(which)': False, 'contains(them)': False}, 'subj')]
test_set = sentim_analyzer.apply_features(testing_docs)
test_set[:1]
[({'contains(.)': True, 'contains(the)': True, 'contains(,)': False, 'contains(a)': True, 'contains(and)': False, 'contains(of)': True, 'contains(to)': False, 'contains(is)': False, 'contains(in)': False, 'contains(with)': True, 'contains(it)': False, 'contains(that)': False, 'contains(his)': False, 'contains(on)': False, 'contains(for)': True, 'contains(an)': False, 'contains(who)': False, 'contains(by)': False, 'contains(he)': False, 'contains(from)': False, 'contains(her)': False, 'contains(")': False, 'contains(film)': False, 'contains(as)': False, 'contains(this)': False, 'contains(movie)': False, 'contains(their)': False, 'contains(but)': False, 'contains(one)': False, 'contains(at)': False, 'contains(about)': False, 'contains(the_NEG)': False, 'contains(a_NEG)': False, 'contains(to_NEG)': False, 'contains(are)': False, "contains(there's)": False, 'contains(()': False, 'contains(story)': False, 'contains(when)': False, 'contains(so)': False, 'contains(be)': False, 'contains(,_NEG)': False, 'contains())': False, 'contains(they)': False, 'contains(you)': False, 'contains(not)': False, 'contains(have)': False, 'contains(like)': False, 'contains(will)': False, 'contains(all)': False, 'contains(into)': False, 'contains(out)': False, 'contains(she)': False, 'contains(what)': False, 'contains(life)': False, 'contains(has)': False, 'contains(its)': False, 'contains(only)': False, 'contains(more)': False, 'contains(even)': False, 'contains(--)': False, 'contains(:)': False, 'contains(can)': False, 'contains(;)': False, 'contains(home)': False, 'contains(look)': False, "contains(it's)": False, 'contains(if)': False, 'contains(where)': False, 'contains(most)': False, 'contains(him)': False, 'contains(search)': False, 'contains(but_NEG)': False, 'contains(love)': False, 'contains(both)': False, 'contains(make)': False, 'contains(begins)': False, 'contains(some)': False, 'contains(two)': False, 'contains(of_NEG)': False, 'contains(made)': False, 'contains(which)': False, 'contains(them)': False}, 'subj')]
trainer = NaiveBayesClassifier.train
classifier = sentim_analyzer.train(trainer, training_set)
Training classifier
for key,value in sorted(sentim_analyzer.evaluate(test_set).items()):
print('{0}: {1}'.format(key,value))
Evaluating NaiveBayesClassifier results... Accuracy: 0.8 F-measure [obj]: 0.8 F-measure [subj]: 0.8 Precision [obj]: 0.8 Precision [subj]: 0.8 Recall [obj]: 0.8 Recall [subj]: 0.8