Just had a quick look, but I think you will only need the regex.
Instead of @intent_handler(IntentBuilder("").require("to.hello.say.intent").require("Name"))
try @intent_handler(IntentBuilder("").require("Name"))
@andlo
Break up your vocab files so each vocab file is a bag of similar meaning words then include each vocab in your “requires” statement. First vocab may have only the word “say”. Second file will have ‘hi’, ‘hello’, ‘high’, last vocab file will have ‘to’, ‘too’, ‘two’. This will significantly reduce the chance that this group of vocab files conflicts with other intents.
I would suggest reading this guideline that was created but the community member @Jarbas_Ai. It has substantially helped me in understanding the best way to create the “bag of words” approach to vocab files.
In the following link the Guidline 4 is a good description on how to use the vocab files.
Hi @andlo, as @pcwii mentioned, @Jarbas_Ai has written a really good introduction to this. In summary though, you’re taking the right approach. In the example you gave, you would name the files something like:
@andlo,
I think there is still a bit to be done in your code (viewed on github). My suggestion is to check your skills.log file and it will report where it is erroring out. I have a simple pick number skill that you can use as a base if you would like.
Since you did not define “Name” as one of your optional vocab files, likely because the name will be dependant on the speaker I would recomend you use the “remainder” option to retrieve everything else that is spoken.
eg. response = message.utterance_remainder()
Don’t be discouraged. It has been just over a year now since I committed to learning python and I have discovered that once you understand syntax a bit as well as how to google what you are looking for, you are well on your way.
Glad you are having some success.
If you use
response = message.utterance_remainder()
This will return any part of the utterance (the sentence you spoke to Mycroft) that is not found in your intent builder. If you speak “say hello to andlo” the remainder will return the word “andlo”. If you speak “say hello to andlo python programmer extraordinaire” the remainder will return “andlo python programmer extraordinaire”. You can then pass this back to the speak_dialog so that Mycroft will respond “hello andlo python programmer extraordinaire”.
I think I get confused by intent_file_handler and intent_handler where intent_handler is using .voc files and intent_file_handler is using .intent.
I have now got it to work using intent_file_handler and one .intent file whit all posible sentenses that should trigger and having {name} in that to.
So it is working and is simple so I can understand what is going on.