Skip to content

Instantly share code, notes, and snippets.

@edwardleoni
Created March 30, 2018 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwardleoni/cf2d7df455ae0046bd26beb88ee5ef5c to your computer and use it in GitHub Desktop.
Save edwardleoni/cf2d7df455ae0046bd26beb88ee5ef5c to your computer and use it in GitHub Desktop.
from word_features import extract
import pickle
import sys
try:
f = open('classifier.pickle', 'rb')
except FileNotFoundError:
print('Classifier not found')
exit()
classifier = pickle.load(f)
f.close()
try:
features = extract(sys.argv[1])
except IndexError:
print('No text supplied to classify')
print(classifier.classify(features))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment