Im trying to find the Precision and Recall of these two sentence but getting following error what am I doing wrong?
Code:
from nltk.metrics import precision, recall
from sklearn.metrics import precision_score
import sklearn.metrics
from sklearn import metrics
from sys import argv
from time import time
import numpy
import csv
import nltk,math
import numpy as np
set1 = "The horse raced past the barn fell"
set2 = "The horse that was raced past the barn fell"
length = np.amin([len(set1),len(set2)])
set1 = set1[:length]
set2 = set2[:length]
K = sklearn.metrics.precision_score(set1,set2,average=None)
print k
Error:
ValueError: Expected array-like (array or non-string sequence), got 'The horse raced past the barn fell'