i write the code as here :
print ('pos precision:', nltk.metrics.precision(refsets['pos'],
testsets['pos']))
print ('pos recall:', nltk.metrics.recall(refsets['pos'],
testsets['pos']))
and the output as here :
line 35, in evaluate_classifier
print ('pos precision:', nltk.metrics.precision(refsets['pos'],
testsets['pos']))
AttributeError: module 'nltk.translate.metrics' has no attribute
'precision'
How can i solve this error ?
No big deal, just not calling the correct method.
Try: nltk.metrics.scores.precision(reference, test)
http://www.nltk.org/api/nltk.metrics.html
ctrl+f for "precision" will get you to documentation
Corrected code:
print('pos precision:', nltk.metrics.scores.precision(refsets['pos'],testsets['pos']))
print('pos recall:', nltk.metrics.scores.recall(refsets['pos'],testsets['pos']))