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.
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?
Thank you submitting the capsule through support ticket.
After reviewing the capsule, I would recommend these 2 fixes:
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.
After compile, as the debugger shows the content of duration
in JS, developer can easily get duration.periodHours
and duration.periodMinutes
as integers.