我试图找到这两句话的精确度和召回但是得到跟随错误我做错了什么?
代码:
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
错误:
ValueError: Expected array-like (array or non-string sequence), got 'The horse raced past the barn fell'