[FREE] Dictionary for Voice assistant

At the request of one of the forum participants, I made a dictionary for dialogue with a voice assistant or chatbot.
The dictionary is loaded from a text file with the following contents:
Question1 # Answer1.1 | Answer1.2 … | Answer 1.N ;
Question2 # Answer2.1 | Answer2.2 … | Answer 2.N ;
………………………………………………………………………………………
QuestionN # AnswerN.1 | AnswerN.2 … | Answer N.N
‘#’,’|’,’;’ separators are required.
If the phrase from the question is contained in the dictionary, a random answer will be returned. Responses will not be repeated until all possible answers are returned.
If the dictionary has only one answer to a question, then this will function too.
Line feeds are ignored. The user can split the lines as he sees fit.
Of course, the same results can be achieved by standard means. My extension just makes it more convenient.

The method:
LoadFromFile
allows you to load a dictionary from a text file. The rules for the file path are the same as for the standard File module
The event:
LoadingComplete
occurs after the word is fully loaded. If the dictionary did not contain errors, then the result = true .
The method:
GetRandomAnswer
returns one of the answers if the question is in the dictionary.
If the dictionary says “what is your first name what is your name # ……”, that method will give answers to the both question “what is your first name” and “what is your name". However, if the dictionary says only “what is your first name # ……”, and you ask “what is your name”, the method will answer with an empty string. Be careful when compiling a dictionary.
The question character ‘?’ can be used at your discretion. It is understood that a speech recognition system does not add a ‘?’ character at the end of a question sentence, unless you ask for it.

Text example:

hellow # Hi! | good afternoon | Do we know each other? | Hi, my name is Eva;
how are you # thanks, I’m fine | perfectly! | I was fine until you asked me about it;
do you love me # I love you | I would go to the cinema with you | Do not tell me about love!

Current Version: ScDictionaryV1.aix (17.6 KB)

14 Likes

Very cool extension. That will help us to create chat bot easily. We have to load always from file manazer.we have no others option to load dictionary

2 Likes

Maybe I need to add a manual dictionary edit.

This post was flagged by the community and is temporarily hidden.

Google Translate:

Good day Contact off topic, do not scold :slight_smile: ScorpioNormal, you get the extensions you need. Maybe you can make a convenient extension for transforming a number from HEX to DEC indicating the digit capacity of the number to be translated? Using standard mathematical tools, this procedure takes too many blocks. It would be great if you just set the value and bit width and get a number … Once again litter for being out of topic.

Please post in English from next time. Other languages are not allowed.

Пожалуйста, пишите на английском в следующий раз. Другие языки не допускаются.

Is the Basic Number Block unsuitable?