April 2016
Beginner to intermediate
384 pages
8h 36m
English
Having gone through all the preparations, we are now ready to embark on a more advanced task: classifying movies based on their reviews. In this recipe, we will use a sentiment analyzer and Naïve Bayes classifier to classify the movies.
To execute this recipe, you will need NLTK and JSON. No other prerequisites are required.
It takes a bit of wrangling but ultimately the code is fairly easy to understand and follow (the nlp_classify.py file):
# this is needed to load helper from the parent folder import sys sys.path.append('..') # the rest of the imports import helper as hlp import nltk import nltk.sentiment as sent import json @hlp.timeit def classify_movies(train, sentim_analyzer): ...Read now
Unlock full access