Phrase generation agent
It is an agent that generates a sc-link with the reply message text, where sc-variables names substituted with constant sc-links contents from knowledge base. This agent is called by StandardMessageReplyAgent to do this work and it returns the own result to him for answering the user question.
Action class:
action_phrase_generation
Parameters:
-
replyMessageNodethat is the result of StandardMessageReplyAgent; -
phraseLinkis a sc-link with a text template. -
parametersNodeis sc-node containing template arguments.
Workflow:
- The agent tries to get
templateNode, that connected withphraseLinkbynrel_phrase_templatenorole relation;

- Then it seeks for arguments of the template -
parametersNode, this node is connected withactionAddrbyrrel_3role relation; - After this the PhraseGenerationAgent generates sc-link by template using
templateNode,parametersNodeandphraseLink;- Processes the regular expressions in
phraseLinkto identify variable names. - Matches the type of regular expression to the variable name.
- Processes the
templateNodeusing theparametersNodeto map variables in thetemplateNodeto the values of their corresponding constants. - Creates the response text by invoking a handler for each variable whose constant value was found. Each handler corresponds to its specific type of regular expression.
- Processes the regular expressions in
- The language of created sc-link depends on language of
phraseLink. If there is alang_runode and a constant positive role relation fromlang_rutophraseLink, then the agent creates similar role relation fromlang_rutolinkResult. If the agent can't find the language of this sc-link, he doesn't create any relation; - Upon successfully generating the response, the agent creates a response structure in the knowledge base corresponding to the identified values.
- A knowledge base structure is created that includes all the nodes involved in creating the response. This structure is needed to be displayed in the interface after the response.
- The final sc-link connects with
actionAddrbynrel_resultnorole relation, PhraseGenerationAgent finishes his work.
Example
Example of an input structure:

Example of an output structure:

Structure of Non-Processable Elements
A specific field of the agent is notSearchable - not_to_search_structure in the knowledge base. notSearchable is used when searching for variable values in the templateNode to exclude certain elements that meet the description but should not be processed.
Result
Possible result codes:
SC_RESULT_OK- the reply message is generated.SC_RESULT_ERROR- internal error, answer can't be found.SC_RESULT_ERROR_INVALID_PARAMS- the action has no reply message or phrase link.