Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to ability to have nested groups for utterances #13

Open
rickwargo opened this issue May 18, 2016 · 6 comments
Open

Need to ability to have nested groups for utterances #13

rickwargo opened this issue May 18, 2016 · 6 comments

Comments

@rickwargo
Copy link

Nested groups are valuable when alternating pronouns or articles of speech in an utterance. For example:

(The best|(A|My) favorite) movie is {Movie}

should expand to:

The best movie is {Movie}
A favorite movie is {Movie}
My favorite movie is {Movie}

I'll work on creating a PR for this functionality.

@mreinstein
Copy link
Contributor

I'm not saying no to this, just playing devil's advocate:

couldn't this be supported by instead declaring the group as

(The best|A favorite|My favorite) movie is {Movie} ?

The nested syntax seems a bit terse.

@rickwargo
Copy link
Author

Definitely makes it harder to read at first. I find myself revisiting utterances and want to expand on the options. The example was quite simple and expanding it makes it easier to read. My templates often have a lot of alternation and I will expand on it to cover as many voice options as possible. When I do this I may want to use nested groups. Admittedly this does not happen often, and when I do need it, I just copy the template and expand upon it. When I do that, though, my utterance templates are not DRY. I'm fine either way considering the implementation is not simple ;)

@scullum
Copy link

scullum commented Jan 27, 2017

Here is an example that I have came across. Supposing that you are using the Amazon Slot types for both city and airport. As the user is going to ask either how long it with take to get to Los Angeles or LAX.

Currently I have to structure it like this:

    'slots': {
      "CITY": "AMAZON.CITY",
      "AIRPORT": "AMAZON.AIRPORT"
    },
    'utterances':[
      "for the {flight time | duration} to {-|CITY}",
      "for the {flight time | duration} to {-|AIRPORT}",

    ]

Would be nice not to have to repeat the initial part in the utterance. Something along these lines:

    'utterances':[
      "for the {flight time | duration} to {{-|CITY} | {-|AIRPORT}}"
    ]

Any insights appreciated!

@mreinstein
Copy link
Contributor

mreinstein commented Jan 27, 2017

This is personal preference, but I find:

"for the {flight time | duration} to {-|CITY}",
"for the {flight time | duration} to {-|AIRPORT}",

to be more readable than:

 "for the {flight time | duration} to {{-|CITY} | {-|AIRPORT}}"

@jlguinn
Copy link

jlguinn commented Feb 19, 2017

I think you have a good thought, but I have to agree with mreinstein. I find utterances to be nearly the perfect balance of simple and powerful. There might be some cases where nested syntax might seem more convenient or even appropriate, but I haven't found anything you flat out can't do with the implementation as-is.

@ericblade
Copy link

ericblade commented Mar 22, 2017

+1 request for nesting support. The "flutterance" utility ( https://www.npmjs.com/package/flutterance ) supports nesting, but does not appear to work on it's own as a library to be included in a package. The specific example from their readme shows: [Hello|Hi|Good [Morning|Afternoon|Evening]] Alexa

... seems like a perfectly good use case. shrug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants