← Natural language processing
Lesson 4 of 4
NLP tasks
Watch, read the card, then practise. Text classification · Named entity recognition
The video for this lesson is being recorded.
Meanwhile, the notes below and the 60-second cards cover the same ideas.
Practise this topicText classification
Text classification gives a whole text a label, like positive or negative, spam or not, or a topic.
Remember: Always compare against a simple baseline.
Named entity recognition
Named entity recognition finds names of people, places, organisations and dates in text.
Remember: B-ORG starts an organisation name; I-ORG continues it.
Try the example in Code Lab
pos, neg = {"good", "love"}, {"bad", "awful"}
words = "i love this phone but the battery is bad".split()
score = sum(w in pos for w in words) - sum(w in neg for w in words)
print("positive" if score > 0 else "negative" if score < 0 else "neutral")