Intents-Managment¶
This microservice is used to identify the requirements of an intent, provide options to complete information and return answer if the intent is completed.
Check also th API description here:
APIS¶
Here we have the different views of the app.
Knowledge Graph Handler¶
KG handler is the main class to encapsulate the methods to access the Knowledge Graph of the chatbot.
-
class
knowledge_graph.
KGHandler
(base_url, path)¶ KGHandler is the main class of this project. It is used to connect to the knowledge base, an retrieve information for intents.
These are the main methods of this class:
-
knowledge_graph.KGHandler.
_build_uri
(self, uri, resource=True)¶ This method builds an URI from a complete URL or just the URI name. This method also checks if the uri is well structured.
Parameters: - uri – the URI or full URL
- resource – If the URI is from the ontology or a resource
Returns: The namespace of the full URI
-
knowledge_graph.KGHandler.
get_intent_requirements
(self, intent)¶ This method returns all required entities of an intent.
Parameters: intent – The intent from where required entities will ne retrieved. Returns: a list of the required entities.
-
knowledge_graph.KGHandler.
clean_uri
(uri)¶ This method is used to remove the URL part of the URI to return the clean property.
Parameters: uri – The URI to be cleaned Returns: The clean property from the URI
-
knowledge_graph.KGHandler.
build_answer_prop_val
(self, qres, ans_prop)¶ This method builds a part of the answer, from the result of a SPARQL query. :param qres: The result from a SPARQL query.
Parameters: ans_prop – The property intended to an answer. Returns: A dict containing a property and a value from the query result.
-
knowledge_graph.KGHandler.
get_answer_properties
(self, intent)¶ This method retrieves the answer properties from an answer class using a SPARQL query. The answer has a series of properties that may or may not be present, depending on the way the answer is configured. If there are more than one properties of an answer, the will be stored in an array.
Parameters: intent – The intent from where the answer will be retrieved Returns: returns the different properties found in the answer object.
-
knowledge_graph.KGHandler.
get_intent_answer
(self, intent, entities_aux)¶ This method returns the full answer from a intent. Using and other method (get_answer_properties) to retrieve the different properties of an Answer Object. And other method (get_answer_parts) to build the key value of properties of an Entity.
Parameters: - intent – The intent from where the answer will be retrieved
- entities_aux – A list of entities, that can be collected in different ways from other components.
Returns: The full answer in a dictionary displayed in this way: { ‘answer’: [{ ‘property’: ‘teacherName’, ‘value’: [‘Diana Lucía Espinoza Torres’, ‘Glenda Edith Ponce Espinosa’]}], ‘template’: ‘El docente encargado del curso es {%teacherName%}’ }
-
knowledge_graph.KGHandler.
get_answer_parts
(self, ans_prop, refers_to, ans_from, entity, entities)¶ This method searches for the real values of the answer of the intent. Depending on the different properties found in the answer object. The answer can be from a direct object, or an indirect object or, from a related object.
Parameters: - ans_prop – A property to retrieve from an object
- refers_to – A related object to obtain a value using ans_prop
- ans_from – An object to obtain a value using ans_prop
- entity – A direct entity to be used in the answer
- entities – A list of auxiliary entities
Returns: The a pair of property an value that conforms an answer.
-
knowledge_graph.KGHandler.
get_intent_options
(self, intent)¶ This method returns the options related to an Intent To complete the different entities needed to satisfy an intent.
Parameters: intent – An intent from where options will be retrieved. Returns: a dict containing, the resolve question, and the different options. Todo
handle custom options
-
knowledge_graph.KGHandler.
get_entity_options
(self, entity)¶ This method returns options to complete an entity.
Parameters: entity – The entity type from where options will be retrieved Returns: returns an entity and their options. Todo
handle custom options
-
knowledge_graph.KGHandler.
find_agent_intents
(self, agent)¶ This method returns information about the chatbot, like name, description and intents.
param agent: A valid agent name
-
knowledge_graph.KGHandler.
get_resolution_question
(self, intent, entity)¶ This method finds the resolution question of an intent and entity :param intent: A valid intent name
Parameters: entity – A valid entity name Returns: A dict with the intent, entity and the resolution question
Check also the TODO lis for this project:
Todo
handle custom options
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/cb-intents-management-ms/checkouts/latest/kbsbot/intents_managment/knowledge_graph.py:docstring of knowledge_graph.KGHandler.get_intent_options, line 8.)
Todo
handle custom options
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/cb-intents-management-ms/checkouts/latest/kbsbot/intents_managment/knowledge_graph.py:docstring of knowledge_graph.KGHandler.get_entity_options, line 7.)
This project is part of the architecture described in: Herrera, Andre & Yaguachi, Lady & Piedra, Nelson. (2019). Building Conversational Interface for Customer Support Applied to Open Campus an Open Online Course Provider. 11-13. 10.1109/ICALT.2019.00011.
\ Sort by:\ best rated\ newest\ oldest\
\\
Add a comment\ (markup):
\``code``
, \ code blocks:::
and an indented block after blank line