rasa.nlu.utils.bilou_utils

You are viewing documentation for our open source project which is maintained by the community. If you want to get started building assistants with Rasa please check out our latest documentation here.

bilou_prefix_from_tag #

bilou_prefix_from_tag(tag: Text) -> Optional[Text]

Returns the BILOU prefix from the given tag.

Arguments:

tag_without_prefix #

tag_without_prefix(tag: Text) -> Text

Remove the BILOU prefix from the given tag.

Arguments:

bilou_tags_to_ids #

bilou_tags_to_ids(message: "Message", tag_id_dict: Dict[Text,int], tag_name: Text = ENTITY_ATTRIBUTE_TYPE) -> List[int]

Maps the entity tags of the message to the ids of the provided dict.

Arguments:

get_bilou_key_for_tag #

get_bilou_key_for_tag(tag_name: Text) -> Text

Get the message key for the BILOU tagging format of the provided tag name.

Arguments:

build_tag_id_dict #

build_tag_id_dict(training_data: "TrainingData", tag_name: Text = ENTITY_ATTRIBUTE_TYPE) -> Optional[Dict[Text,int]]

Create a mapping of unique tags to ids.

Arguments:

apply_bilou_schema #

apply_bilou_schema(training_data: "TrainingData") -> None

Get a list of BILOU entity tags and set them on the given messages.

Arguments:

apply_bilou_schema_to_message #

apply_bilou_schema_to_message(message: "Message") -> None

Get a list of BILOU entity tags and set them on the given message.

Arguments:

map_message_entities #

map_message_entities(message: "Message", attribute_key: Text = ENTITY_ATTRIBUTE_TYPE) -> List[Tuple[int,int, Text]]

Maps the entities of the given message to their start, end, and tag values.

Arguments:

bilou_tags_from_offsets #

bilou_tags_from_offsets(tokens: List["Token"], entities: List[Tuple[int,int, Text]]) -> List[Text]

Creates BILOU tags for the given tokens and entities.

Arguments:

ensure_consistent_bilou_tagging #

ensure_consistent_bilou_tagging(predicted_tags: List[Text], predicted_confidences: List[float]) -> Tuple[List[Text], List[float]]

Ensure predicted tags follow the BILOU tagging schema.

We assume that starting B- tags are correct. Followed tags that belong to start tag but have a different entity type are updated considering also the confidence values of those tags.
For example, B-a I-b L-a is updated to B-a I-a L-a and B-a I-a O is changed to B-a L-a.

Arguments:

List of tags.
List of confidences.