How does text classification differ from token classification?
Reveal the answer and explore the explanation.
01EasyCoreHow does text classification differ from token classification?
Answer
EasyCore
How does text classification differ from token classification?
Answer
Assigns one or more predefined labels to a text input.
Practical example
Categorize support tickets by issue type.
PythonRelated concept example
from collections import Counter
pred, ref = 'new york city'.split(), 'new york'.split()
match = sum((Counter(pred)&Counter(ref)).values())
p,r = match/len(pred),match/len(ref)
print(2*p*r/(p+r))Simple token overlap F1 for nonempty answers.
Reference: Further reading ↗