Utils¶
Here we present all the utility methods to help transform the data to present to the user.
These are the main methods of this class:
-
compose_utils.
clean_uri
(uri)¶ This method removes the url part of the URI in order to obtain just the property or class
Parameters: uri – An uri to be cleaned Returns: The name of the property or the class
-
compose_utils.
check_requirements
(requirements, entities)¶ This method compares the existing entities and the entities required to complete an intent.
Parameters: - requirements – The list of the entities needed
- entities – The list of current entities
Returns: If entities are missing, a list of this missing entities
-
compose_utils.
build_answer
(raw_answer, answer_type)¶ This method builds the answer, depending of the type of answer.
Parameters: - raw_answer – A dict containing the template of the answer, and the different part of tha answer
- answer_type – The type of answer to be constructed
Returns: the raw text of the final answer
-
compose_utils.
update_entities
(current_entities, new_entities)¶ This method updates the current list of entities, by looking for the same type of entity.
- Parameters:
param current_entities: Current list of entities param new_entities: New list of entities return: Current list of entities updated