12
$\begingroup$

I would like to create custom Named Entity Recognition (NER), but I am confused about what BIO Tags are. Could anyone please explain the steps for creating NER and about this B, I, O tag.

$\endgroup$

2 Answers 2

8
$\begingroup$

It is easy. You need to tag a phrase using B (Begin), I (Interior), and E (End). For example, you want to tag "United States of America" as the name of a country. You will tag likes:

United(B_Country) States(I_Country) of(I_Country) America(E_Country)

In the same text if you find "Islamic Republic of Iran", you will tag likes:

Islamic(B_Country) Republic(I_Country) of(I_Country) Iran(E_Country)

Also, you will tag "United Kingdom" likes:

United(B_Country) Kingdom(E_Country)

Therefore, for every label that you have in the label set, you will have three labels in the tagging that is B_LabelName, I_LabelName, and E_LabelName.

Notice that In some tagging systems, also uses from I_LabelName instead of E_LabelName.

Now, what is "O"? In some cases the all part of the phrase is not in the label but comming in the middle of the phrase and we need to say it is out ("O") of the label. For example, in the text analysis we want to take out "of" from country names. Hence we will tag "United States of America" like the following:

United(B_Country) States(I_Country) of(O_Country) America(E_Country/I_Country)
$\endgroup$
3
  • $\begingroup$ +1, but the case of O is mostly for anything outside of a NE, not only in the middle of a NE. It's the default category, since most words in a text are not part of a NE. $\endgroup$
    – Erwan
    Commented Nov 20, 2019 at 0:48
  • $\begingroup$ Thank you .but what if i have a long sentence with multiple tokens to tag ? " football wold cup was played between brazil and united states of america in oylmpics statidum " ho do i do the O tagging here ? why is is BIO tag really necessary for NER ? $\endgroup$
    – star
    Commented Nov 20, 2019 at 5:43
  • $\begingroup$ @Aj_MLstater no difference. "O" is used for the cases that you cannot assign a tag from the tag set to a word. $\endgroup$
    – OmG
    Commented Nov 20, 2019 at 12:20
1
$\begingroup$

BIO Tagging : Common tagging format for tagging tokens in a chunking task in computational linguistics. BIO / IOB format (short for inside, outside, beginning) is a common tagging format for tagging tokens in a chunking task in computational linguistics (ex. named-entity recognition). The B- prefix before a tag indicates that the tag is the beginning of a chunk, and an I- prefix before a tag indicates that the tag is inside a chunk. The B- tag is used only when a tag is followed by a tag of the same type without O tokens between them. An O tag indicates that a token belongs to no entity/chunk.

You can use flair library (https://github.com/flairNLP/flair) to learn your own custom NER model, which is also called sequence tagging in literature. Refer : https://medium.com/thecyphy/training-custom-ner-model-using-flair-df1f9ea9c762

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.