When I run this code it throws an error which I believe is due to the batch_classify method not being present in NLTK 3.0. I curious how to resolve this type of issue where something from an older version disappears in the newer version.
def accuracy(classifier, gold):
results = classifier.batch_classify([fs for (fs,l) in gold])
correct = [l==r for ((fs,l), r) in zip(gold, results)]
if correct:
return float(sum(correct))/len(correct)
else:
return 0
def apr (classifier, gold):
results = classifier.batch_classify([fs for (fs,l) in gold])
#gold_class_dict = defaultdict(list)
#classifier_class_dict = {}
sys_correct_dict = Counter()
num_guessed = Counter()
gold_num = Counter()
num_right = 0
total = 0
nltk? Trypip install -U nltkon the terminal / powershell. - alvas