Tagged: RuleORama Grammer
March 21, 2017 at 1:41 pm #1031693
Hi, I’m quite new to OpenEars. I have been experimenting RuleORama. I have two questions:
Here is the grammar structure:
let grammar = [
ThisWillBeSaidOnce : [
[ OneOfTheseWillBeSaidOnce : ["HELLO", "GREETINGS"]],
[ OneOfTheseCanBeSaidOnce : ["COMPUTER", "ROBOT"]],
[ OneOfTheseWillBeSaidOnce : ["GO", "MOVE"]],
[ThisWillBeSaidWithOptionalRepetitions : [
[ OneOfTheseWillBeSaidOnce : ["10", "20","30"]],
[ OneOfTheseWillBeSaidOnce : ["LEFT", "RIGHT", "FORWARD"]]
[ ThisCanBeSaidOnce : ["THANK YOU"]]
(1) I built (Swift 3) the project onto by iPhone and said: “Hello go 20 left, 30 right”
Here is the response: “HELLO ROBOT GO 20 LEFT HELLO GO 30 RIGHT” with a score of (-60563) and an utterance ID of 2.
It picked up an extra ‘ROBOT,’ but my question is how did pick up the second ‘GO’? Did I make a mistake in the structure above?
(2) Just to confirm I get this: If there 5 distinct statements a user could make (where the above was 1 of them), to do this I would change at the ThisWillBeSaidOnce at the top level to OneOfTheseWillBeSaidOnce with five sets of .
Thanks for any help!
March 21, 2017 at 8:35 pm #1031696Halle WinklerPolitepix
- This topic was modified 4 years, 1 month ago by kdsaft.
The hypothesis is actually two complete recognitions according to your ruleset (RuleORama can return more than one complete rule-conforming utterances in a single hypothesis if they were uttered). The reason that it doesn’t correspond to your real utterance is because for performance reasons, RuleORama doesn’t support optional repetitions, so it reduces them to a single repetition. This is mentioned in the docs and the verbose logging, but it’s the kind of small detail it’s easy to accidentally overlook when you’re first getting started. So, the answer is that there is nothing wrong with your ruleset, but your optionals are silently turning into single repetitions only.March 22, 2017 at 1:41 pm #1031698
Ah, got it! Thank-you!!
I tried this:
let grammar = [ OneOfTheseWillBeSaidOnce : [ [ ThisWillBeSaidOnce : [ [ ThisWillBeSaidOnce : ["HOW MUCH"]], [ OneOfTheseWillBeSaidOnce : ["FLOUR", "SUGAR", "BUTTER"]]]], [ ThisWillBeSaidOnce : [ [ ThisWillBeSaidOnce : ["HOW MANY"]], [ OneOfTheseWillBeSaidOnce : ["EGGS", "APPLES", "PEARS"]]]] ]]
with my expectation that the user could say either “How much flour/sugar/butter” OR “How many eggs/apples/pears”. However from the log it generated:
HOW MUCH BUTTER HOW MANY APPLES HOW MUCH BUTTER HOW MANY EGGS HOW MUCH BUTTER HOW MANY PEARS HOW MUCH FLOUR HOW MANY APPLES HOW MUCH FLOUR HOW MANY EGGS HOW MUCH FLOUR HOW MANY PEARS HOW MUCH SUGAR HOW MANY APPLES HOW MUCH SUGAR HOW MANY EGGS HOW MUCH SUGAR HOW MANY PEARS
What did I do wrong?
KeithMarch 22, 2017 at 10:23 pm #1031701Halle WinklerPolitepix
The outermost rule needs to be a ThisWillBeSaidOnce enclosing the rest of your grammar; otherwise it ought to work.March 23, 2017 at 10:29 am #1031702
Cool! That worked! Thank-you!
- You must be logged in to reply to this topic.