canonical_label#

scikitplot.cleanprompt.canonical_label(label)[source]#

Map an engine’s entity label onto the canonical vocabulary.

Parameters:
labelstr

The label an engine reported, for example "ORGANIZATION".

Returns:
str

The canonical label, or "MISC" when the engine’s label has no mapping.

Parameters:

label (str)

Return type:

str

Notes

Developer notes. Unknown labels become MISC rather than being dropped. A model that found something and a mapping that has not caught up are two different problems, and discarding the entity would turn a vocabulary gap into a privacy hole.

Examples

>>> canonical_label("ORGANIZATION")
'ORG'
>>> canonical_label("ORG")
'ORG'
>>> canonical_label("SOMETHING_NEW")
'MISC'