Token Classification
Token classification labels each word in a sentence, for example as a person, place or organization.
Inputs
Input
Mai flew from Hanoi to Berlin with Lufthansa.
Token Classification Model
Output
Output
- Mai · PER0.99
- Hanoi · LOC0.98
- Lufthansa · ORG0.95
About Token Classification
Token classification labels each word in a sentence, for example as a person, place or organization. Browse token classification models on HubClone to compare checkpoints, or open a Space to try one in the browser.
Use Cases
Named entity recognition
Extract names and places from news articles.
Part-of-speech tagging
Mark nouns, verbs and adjectives for linguistic analysis.
Inference
The Transformers pipeline API runs token classification models in a few lines. Replace <model-id> with any model listed on this page.
from transformers import pipeline
pipe = pipeline("token-classification", model="<model-id>")
pipe("Mai flew from Hanoi to Berlin with Lufthansa.")Useful Resources
Want to dig deeper into the topic? Great! Here is a hand-picked list of resources we found helpful.
Documentation
- Token Classification task guide
- Pipelines reference
Notebooks
- Fine-tuning a token classification model