Search code examples
timepickerbixby

How do I train time-picker with voice?


[bixby] My Bixby capsule works fine if the user selects the time on-screen, but not if they try to select it by voice. I followed the training offered for "duration" in this example, but it doesn't seem to apply enter link description here for a "time"

structure (BedTime) { description (DESCRIPTION) role-of (time.Time) }

action (PrepareUserData) { description ("Prepare user data") type (Search) collect { // Keep this in place to retrieve any previously stored UserData computed-input (previousUserData) { type (UserData) min (Required) max (One) compute { intent { goal: GetUserData } } }

    input (username) {
        type (UserName)
        min (Required) max (One)
    }

    input (wakeuptime) {
        type (WakeupTime)
        min (Required) max (One)
    }

    input (bedtime) {
        type (BedTime)
        min (Required) max (One)
    }

    input (message) {
        type (Message)
        min (Required) max (One)
    }
}
output (UserData)

}

enter image description here

This training is "not learned" and when I invoke the utterance, it keeps asking me again

Modified training

[![Wakeup training [][4]]4][5]

[5]: https://i.sstatic.net/YQvlg.jpgenter code here


Solution

  • Without actual capsule code, I can only speculate.

    First, the concept should be viv.time.DateTimeExpression to better work with natural language such as "9PM tonight". You can read more about viv.time.DateTimeExpression here.

    Second, the utterance "bedtime" is not an expected NL input for time. It should be more specific such as "9PM" or "8AM this Wednesday", or "8PM tomorrow".

    Third topic is more like a heads-up. If use utterance such as "9PM Wednesday" for viv.time.DateTimeExpression, you may get more than 1 return value. It is confusing but understandable since it could be the Wednesday already passed or the coming Wednesday. So developer should take this into consideration, and handle such case in modeling or in JS.

    I've spent sometime to do a sample capsule. It is not difficult to do except the following two catches:

    1. The goal must a user-defined concept, thus cannot be viv.time.Time. Must be MyTime which is a roll-of viv.time.Time.
    2. The NL "9 PM" must be treated as viv.time.DateTimeExpression, so it requires an extra step to MyTime (role-of viv.time.Time)

    Please see the attached screenshot. For a complete capsule you can test, you can download it. training example