Genie Community Forum

Training Almond

How do I train Almond? I’d like to start with “throw dice”, which should return random number between 1 and 6.

I tried on Gnome desktop app. There’s a Train command in menu, which inserts prompt “Retrain the last command” which always returns answer “Sorry, I did not understand that. Can you rephrase it?”.

What went wrong here?

I also tried to train it online, where I can enter training prompt and ThingTalk expression. I read about ThingTalk and found where in code the random integer functions is, but I could not construct ThingTalk expression which would be accepted by online tool. This is as far as I got:

now => @org.thingpedia.builtin.thingengine.builtin.get_random_between(low=1, high=6) => notify;

This throws error Cannot find entity 6 of type NUMBER, have {}. What am I missing?

Extra, question - if I train Almond online, will the connected Gnome app also be trained? Would I be able to use online training with Gnome skills?

Hi @jmiskovic! Welcome to Almond!

I’m sorry the Train functionality in the GNOME app does not work. I have filed an issue in our GitHub to track it, and we’ll investigate: https://github.com/stanford-oval/almond-gnome/issues/55

The preferred way to train is through the Train Almond web page, which I’m glad you found.
If you train there, it automatically affects all apps that use our NLP server (which at the moment are all of them). You can also train GNOME or other platform-specific skills from there.

The error you’re seeing is because you mention the number 6 in the code, but not in the sentence. Because numbers are open-ended, and the neural network would have a hard-time guessing the right number from thin air, this is not allowed. Numbers (other than 1 and 0) must be mentioned in the sentence to be used in the code.
At the same time, the two parameters of get_random_between are optional, and as it happens their default are indeed 1 and 6, so you should be able to train “throw dice” to map to:

now => @org.thingpedia.builtin.thingengine.builtin.get_random_between() => notify;

Hope this helps!

I’ve subscribed to issue, and I’m available for testing as it gets fixed. Thanks for opening it.

OK, so I’m not able to use any “magic numbers”. Can you please walk me through building a D20 dice? How do I introduce number of sides as parameter?

Also, can you please explain what “Edit ThingTalk before learning” checkbox does? When to use it?

If you split D and 20 as “throw a D 20 dice”, then the number 20 will be available in the sentence and you can annotate as:

now => @org.thingpedia.builtin.thingengine.builtin.get_random_between(low=1, high=20) => notify;

If you’re typing, I understand this is suboptimal because D20 is normally written as one word. With voice, it’s whatever the voice model does wrt to spaces, which I’m not sure off the top of my head.

By the way, the limitation on numbers is a long standing compromise that we made to simplify our model and reduce the amount of training data we need. As this is not the first case to break, and given our model can in principle learn to predict the numbers, we might relax it in the future.

1 Like