Search code examples
durationbixby

training time duration in bixby


I am building a sample capsule where i will add user activity data. The sample utterance would be "I walked for 2 hr and completed 2 km distance". The training source code is as follow

[g:AddExerciseResultConcept] i (walked)[v:ExerciseType:Walking] for (2 hr)[v:time.DateTimeExpression] and completed (2 km)[v:measurement.Length]

IDE showing it as a illegal plan.

enter image description here

My action model is like

action (AddExercise) {
       description (adding exercise value)
       type (Search)
       collect {
         input (duration) {
         type (time.DurationPeriod)
         min (Required) max (One)
       }    
       input (distance) {
         type (measurement.Length)
         min (Optional) 
       }
       input (exerciseType) {
         type (ExerciseType)
         min (Required) max (One)
       }
      }
      output (AddExerciseResultConcept)
}

The AddExerciseResultConcept is of type text. What mistake did i make here?


Solution

  • Thank you submitting the capsule through support ticket.

    After reviewing the capsule, I would recommend these 2 fixes:

    1. disable training of similar utterance but different goal.
    2. use viv.time.DurationPeriod as tagged input and action input type.

    In this screenshot, I've added a training example with minutes. Please also note I've disable the last training as it is similar utterance with a different action that could cause confusion. enter image description here

    After compile, as the debugger shows the content of duration in JS, developer can easily get duration.periodHours and duration.periodMinutes as integers. enter image description here