notice

This is documentation for Rasa Documentation v2.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (3.x).

Version: 2.x

rasa.nlu.training_data.entities_parser

EntityAttributes Objects

class EntityAttributes(NamedTuple)

Attributes of an entity defined in markdown data.

find_entities_in_training_example

find_entities_in_training_example(example: Text) -> List[Dict[Text, Any]]

Extracts entities from an intent example.

Arguments:

  • example - Intent example.

Returns:

Extracted entities.

extract_entity_attributes

extract_entity_attributes(match: Match) -> EntityAttributes

Extract the entity attributes, i.e. type, value, etc., from the regex match.

Arguments:

  • match - Regex match to extract the entity attributes from.

Returns:

EntityAttributes object.

extract_entity_attributes_from_dict

extract_entity_attributes_from_dict(entity_text: Text, match: Match) -> EntityAttributes

Extract entity attributes from dict format.

Arguments:

  • entity_text - Original entity text.
  • match - Regex match.

Returns:

Extracted entity attributes.

get_validated_dict

get_validated_dict(json_str: Text) -> Dict[Text, Text]

Converts the provided json_str to a valid dict containing the entity attributes.

Users can specify entity roles, synonyms, groups for an entity in a dict, e.g. [LA]{"entity": "city", "role": "to", "value": "Los Angeles"}.

Arguments:

  • json_str - The entity dict as string without "{}".

Raises:

ValidationError if validation of entity dict fails. JSONDecodeError if provided entity dict is not valid json.

Returns:

Deserialized and validated json_str.

replace_entities

replace_entities(training_example: Text) -> Text

Replace special symbols related to the entities in the provided training example.

Arguments:

  • training_example - Original training example with special symbols.

Returns:

String with removed special symbols.

parse_training_example

parse_training_example(example: Text, intent: Optional[Text] = None) -> "Message"

Extract entities and synonyms, and convert to plain text.