Welcome to the Hugging Face tasks series!
In this video we’ll take a look at the token classification task.
Token classification is the task of assigning a label to each token in a sentence.
There are various token classification tasks and the most common are Named Entity Recognition
and Part-of-Speech Tagging.
Let’s take a quick look at the Named Entity Recognition task.
The goal of this task is to find the entities in a piece of text, such as person, location,
or organization.
This task is formulated as labelling each token with one class for each entity, and
another class for tokens that have no entity.
Another token classification task is part-of-speech tagging.
The goal of this task is to label the words for a particular part of a speech, such as
noun, pronoun, adjective, verb and so on.
This task is formulated as labelling each token with parts of speech.
Token classification models are evaluated on Accuracy, Recall, Precision and F1-Score.
The metrics are calculated for each of the classes.
We calculate true positive, true negative and false positives to calculate precision
and recall, and take their harmonic mean to get F1-Score.
Then we calculate it for every class and take the overall average to evaluate our model.
An example dataset used for this task is ConLL2003.
Here, each token belongs to a certain named entity class, denoted as the indices of the
list containing the labels.
You can extract important information from invoices using named entity recognition models,
such as date, organization name or address.
For more information about the Token classification task, check out the Hugging Face course.