-
Notifications
You must be signed in to change notification settings - Fork 0
/
interpret.go
28 lines (25 loc) · 1.02 KB
/
interpret.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package aurora
import (
"github.com/auroraapi/aurora-go/api"
)
// Interpret contains the results from a call to the Aurora Interpret service.
type Interpret struct {
// Intent represents the intent of the user. This can be an empty string if
// the intent of the user was unclear. Otherwise, it will be one of the
// pre-determined values listed in the Aurora dashboard.
Intent string
// Entities contain auxiliary information about the user's utterance. This
// can be an empty map if no such information was detected. Otherwise, it
// will be a key-value listing according to the entities described on the
// Aurora dashboard.
Entities map[string]string
}
// NewInterpret takes a response from the API and creates an Interpet object
// out of it. It doesn't really make sense for a developer to call this, but
// it is left exported in case it makes sense in the future.
func NewInterpret(res *api.InterpretResponse) *Interpret {
if res == nil {
return nil
}
return &Interpret{Intent: res.Intent, Entities: res.Entities}
}