Documentation ¶
Index ¶
- Constants
- type App
- type AppTag
- type AppTrainingStatus
- type Client
- func (c *Client) AddEntityKeyword(entityID string, keyword EntityKeyword) (*Entity, error)
- func (c *Client) AddEntityKeywordSynonym(entityID string, keyword string, synonym string) (*Entity, error)
- func (c *Client) AddTraitValue(traitName string, value string) (*Trait, error)
- func (c *Client) CreateApp(app App) (*CreatedApp, error)
- func (c *Client) CreateAppTag(appID string, tag string) (*AppTag, error)
- func (c *Client) CreateEntity(entity Entity) (*Entity, error)
- func (c *Client) CreateIntent(name string) (*Intent, error)
- func (c *Client) CreateTrait(name string, values []string) (*Trait, error)
- func (c *Client) DeleteApp(id string) error
- func (c *Client) DeleteAppTag(appID, tagID string) error
- func (c *Client) DeleteEntity(entityID string) error
- func (c *Client) DeleteEntityKeyword(entityID string, keyword string) error
- func (c *Client) DeleteEntityKeywordSynonym(entityID string, keyword string, expression string) error
- func (c *Client) DeleteEntityRole(entityID string, role string) error
- func (c *Client) DeleteIntent(name string) error
- func (c *Client) DeleteTrait(name string) error
- func (c *Client) DeleteTraitValue(traitName string, value string) error
- func (c *Client) DeleteUtterances(texts []string) (*TrainingResponse, error)
- func (c *Client) Detect(text string) (*Locales, error)
- func (c *Client) Export() (string, error)
- func (c *Client) GetApp(id string) (*App, error)
- func (c *Client) GetAppTag(appID, tagID string) (*AppTag, error)
- func (c *Client) GetAppTags(appID string) ([][]AppTag, error)
- func (c *Client) GetApps(limit int, offset int) ([]App, error)
- func (c *Client) GetEntities() ([]Entity, error)
- func (c *Client) GetEntity(entityID string) (*Entity, error)
- func (c *Client) GetIntent(name string) (*Intent, error)
- func (c *Client) GetIntents() ([]Intent, error)
- func (c *Client) GetTrait(name string) (*Trait, error)
- func (c *Client) GetTraits() ([]Trait, error)
- func (c *Client) GetUtterances(limit int, offset int) ([]Utterance, error)
- func (c *Client) MoveAppTag(appID, tagID string, to string, updated *AppTag) (*MovedAppTag, error)
- func (c *Client) Parse(req *MessageRequest) (*MessageResponse, error)
- func (c *Client) SetHTTPClient(httpClient *http.Client)
- func (c *Client) Speech(req *MessageRequest) (*MessageResponse, error)
- func (c *Client) TrainUtterances(trainings []Training) (*TrainingResponse, error)
- func (c *Client) UpdateApp(id string, app App) error
- func (c *Client) UpdateAppTag(appID, tagID string, updated AppTag) (*AppTag, error)
- func (c *Client) UpdateEntity(entityID string, entity Entity) error
- type CreatedApp
- type Entity
- type EntityKeyword
- type Intent
- type Locale
- type Locales
- type MessageContext
- type MessageCoords
- type MessageEntity
- type MessageIntent
- type MessageRequest
- type MessageResponse
- type MessageTrait
- type MovedAppTag
- type Speech
- type Time
- type Training
- type TrainingEntity
- type TrainingResponse
- type TrainingTrait
- type Trait
- type TraitValue
- type UpdateAppTagRequest
- type UpdateAppTagResponse
- type Utterance
- type UtteranceEntity
- type UtteranceIntent
- type UtteranceTrait
Constants ¶
const ( // DefaultVersion - https://wit.ai/docs/http/20200513/ DefaultVersion = "20200513" // WitTimeFormat - the custom format of the timestamp sent by the api WitTimeFormat = "2006-01-02T15:04:05Z0700" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { ID string `json:"id,omitempty"` Name string `json:"name"` Lang string `json:"lang"` Private bool `json:"private"` // Timezone is only used when creating/updating an app; it's // not available when getting the details of an app. Timezone string `json:"timezone,omitempty"` CreatedAt Time `json:"created_at,omitempty"` WillTrainAt Time `json:"will_train_at,omitempty"` LastTrainedAt Time `json:"last_trained_at,omitempty"` LastTrainingDurationSecs int `json:"last_training_duration_secs,omitempty"` TrainingStatus AppTrainingStatus `json:"training_status,omitempty"` }
type AppTag ¶
type AppTag struct { Name string `json:"name,omitempty"` Desc string `json:"desc,omitempty"` CreatedAt Time `json:"created_at,omitempty"` UpdatedAt Time `json:"updated_at,omitempty"` }
AppTag - https://wit.ai/docs/http/20200513/#get__apps__app_tags__tag_link
type AppTrainingStatus ¶
type AppTrainingStatus string
AppTrainingStatus - Represents the status of an app
const ( // Done status Done AppTrainingStatus = "done" // Scheduled status Scheduled AppTrainingStatus = "scheduled" // Ongoing status Ongoing AppTrainingStatus = "ongoing" )
type Client ¶
type Client struct { APIBase string Token string Version string // contains filtered or unexported fields }
Client - Wit.ai client type
func (*Client) AddEntityKeyword ¶
func (c *Client) AddEntityKeyword(entityID string, keyword EntityKeyword) (*Entity, error)
AddEntityKeyword - Add a possible value into the list of values for the keyword entity.
https://wit.ai/docs/http/20200513/#post__entities__entity_keywords_link
func (*Client) AddEntityKeywordSynonym ¶
func (c *Client) AddEntityKeywordSynonym(entityID string, keyword string, synonym string) (*Entity, error)
AddEntityKeywordSynonym - Create a new synonym of the canonical value of the keywords entity.
https://wit.ai/docs/http/20200513/#post__entities__entity_keywords__keyword_synonyms_link
func (*Client) AddTraitValue ¶
AddTraitValue - create a new value for a trait.
https://wit.ai/docs/http/20200513/#post__traits__trait_values_link
func (*Client) CreateApp ¶
func (c *Client) CreateApp(app App) (*CreatedApp, error)
CreateApp - creates new app.
func (*Client) CreateAppTag ¶
CreateAppTag - Take a snapshot of the current app state, save it as a tag (version) of the app. The name of the tag created will be returned in the response.
https://wit.ai/docs/http/20200513/#post__apps__app_tags_link
func (*Client) CreateEntity ¶
CreateEntity - Creates a new entity with the given attributes
func (*Client) CreateIntent ¶
CreateIntent - creates a new intent with the given name.
func (*Client) CreateTrait ¶
CreateTrait - creates a new trait with the given values.
func (*Client) DeleteAppTag ¶
DeleteAppTag - Permanently delete the tag.
https://wit.ai/docs/http/20200513/#delete__apps__app_tags__tag_link
func (*Client) DeleteEntity ¶
DeleteEntity - deletes entity by ID or name.
https://wit.ai/docs/http/20200513/#delete__entities__entity_link
func (*Client) DeleteEntityKeyword ¶
DeleteEntityKeyword - Delete a keyword from the keywords entity.
https://wit.ai/docs/http/20200513/#delete__entities__entity_keywords__keyword_link
func (*Client) DeleteEntityKeywordSynonym ¶
func (c *Client) DeleteEntityKeywordSynonym(entityID string, keyword string, expression string) error
DeleteEntityKeywordSynonym - Delete a synonym of the keyword of the entity.
https://wit.ai/docs/http/20200513/#delete__entities__entity_keywords__keyword_synonyms__synonym_link
func (*Client) DeleteEntityRole ¶
DeleteEntityRole - deletes entity role.
https://wit.ai/docs/http/20200513/#delete__entities__entity_role_link
func (*Client) DeleteIntent ¶
DeleteIntent - permanently deletes an intent by name.
https://wit.ai/docs/http/20200513/#delete__intents__intent_link
func (*Client) DeleteTrait ¶
DeleteTrait - permanently deletes a trait.
https://wit.ai/docs/http/20200513/#delete__traits__trait_link
func (*Client) DeleteTraitValue ¶
DeleteTraitValue - permanently deletes the trait value.
https://wit.ai/docs/http/20200513/#delete__traits__trait_values__value_link
func (*Client) DeleteUtterances ¶
func (c *Client) DeleteUtterances(texts []string) (*TrainingResponse, error)
DeleteUtterances - Delete validated utterances from your app.
func (*Client) Detect ¶
Detect - returns the detected languages from query - https://wit.ai/docs/http/20200513#get__language_link
func (*Client) Export ¶
Export - Returns download URI. https://wit.ai/docs/http/20170307#get__export_link
func (*Client) GetAppTag ¶
GetAppTag - returns the detail of the specified tag.
https://wit.ai/docs/http/20200513/#get__apps__app_tags__tag_link
func (*Client) GetAppTags ¶
GetAppTags - Returns an array of all tag groups for an app. Within a group, all tags point to the same app state (as a result of moving tags).
func (*Client) GetEntities ¶
GetEntities - returns list of entities.
func (*Client) GetEntity ¶
GetEntity - returns entity by ID or name.
https://wit.ai/docs/http/20200513/#get__entities__entity_link
func (*Client) GetIntent ¶
GetIntent - returns intent by name.
https://wit.ai/docs/http/20200513/#get__intents__intent_link
func (*Client) GetIntents ¶
GetIntents - returns the list of intents.
func (*Client) GetUtterances ¶
GetUtterances - Returns an array of utterances.
func (*Client) MoveAppTag ¶
MoveAppTag - move the tag to point to another tag.
https://wit.ai/docs/http/20200513/#put__apps__app_tags__tag_link
func (*Client) Parse ¶
func (c *Client) Parse(req *MessageRequest) (*MessageResponse, error)
Parse - parses text and returns entities
func (*Client) SetHTTPClient ¶
SetHTTPClient allows to use your custom http.Client
func (*Client) Speech ¶
func (c *Client) Speech(req *MessageRequest) (*MessageResponse, error)
Speech - sends audio file for parsing
func (*Client) TrainUtterances ¶
func (c *Client) TrainUtterances(trainings []Training) (*TrainingResponse, error)
TrainUtterances - Add utterances (sentence + entities annotations) to train your app programmatically.
func (*Client) UpdateAppTag ¶
UpdateAppTag - Update the tag's name or description
https://wit.ai/docs/http/20200513/#put__apps__app_tags__tag_link
func (*Client) UpdateEntity ¶
UpdateEntity - Updates an entity by ID or name.
https://wit.ai/docs/http/20200513/#put__entities__entity_link
type CreatedApp ¶
CreatedApp - https://wit.ai/docs/http/20200513/#post__apps_link
type Entity ¶
type Entity struct { ID string `json:"id"` Name string `json:"name"` Lookups []string `json:"lookups,omitempty"` Roles []string `json:"roles,omitempty"` Keywords []EntityKeyword `json:"keywords,omitempty"` }
Entity represents a wit-ai Entity.
type EntityKeyword ¶
EntityKeyword is a keyword lookup for an Entity.
https://wit.ai/docs/http/20200513/#post__entities__entity_keywords_link
type Intent ¶
type Intent struct { ID string `json:"id"` Name string `json:"name"` Entities []Entity `json:"entities,omitempty"` }
Intent - represents a wit-ai intent.
type Locale ¶
Locale - https://wit.ai/docs/http/20200513#get__language_link
type Locales ¶
type Locales struct {
DetectedLocales []Locale `json:"detected_locales"`
}
Locales - https://wit.ai/docs/http/20200513#get__language_link
type MessageContext ¶
type MessageContext struct { ReferenceTime string `json:"reference_time"` // "2014-10-30T12:18:45-07:00" Timezone string `json:"timezone"` Locale string `json:"locale"` Coords MessageCoords `json:"coords"` }
MessageContext - https://wit.ai/docs/http/20170307#context_link
type MessageCoords ¶
MessageCoords - https://wit.ai/docs/http/20170307#context_link
type MessageEntity ¶
type MessageEntity struct { ID string `json:"id"` Name string `json:"name"` Role string `json:"role"` Start int `json:"start"` End int `json:"end"` Body string `json:"body"` Value string `json:"value"` Confidence float64 `json:"confidence"` Entities []MessageEntity `json:"entities"` Extra map[string]interface{} `json:"-"` }
MessageEntity - https://wit.ai/docs/http/20200513/#get__message_link
type MessageIntent ¶
type MessageIntent struct { ID string `json:"id"` Name string `json:"name"` Confidence float64 `json:"confidence"` }
MessageIntent - https://wit.ai/docs/http/20200513/#get__message_link
type MessageRequest ¶
type MessageRequest struct { Query string `json:"q"` Tag string `json:"tag"` N int `json:"n"` Context *MessageContext `json:"context"` Speech *Speech `json:"-"` }
MessageRequest - https://wit.ai/docs/http/20200513/#get__message_link
type MessageResponse ¶
type MessageResponse struct { ID string `json:"msg_id"` Text string `json:"text"` Intents []MessageIntent `json:"intents"` Entities map[string][]MessageEntity `json:"entities"` Traits map[string][]MessageTrait `json:"traits"` }
MessageResponse - https://wit.ai/docs/http/20200513/#get__message_link
type MessageTrait ¶
type MessageTrait struct { ID string `json:"id"` Value string `json:"value"` Confidence float64 `json:"confidence"` Extra map[string]interface{} `json:"-"` }
MessageTrait - https://wit.ai/docs/http/20200513/#get__message_link
type MovedAppTag ¶
type Speech ¶
type Speech struct { File io.Reader `json:"file"` ContentType string `json:"content_type"` // Example: audio/raw;encoding=unsigned-integer;bits=16;rate=8000;endian=big }
Speech - https://wit.ai/docs/http/20170307#post__speech_link
type Time ¶
Time - Custom type to encapsulated a time.Time
func (*Time) UnmarshalJSON ¶
UnmarshalJSON - Our unmarshal function for our custom type
type Training ¶
type Training struct { Text string `json:"text"` Intent string `json:"intent,omitempty"` Entities []TrainingEntity `json:"entities"` Traits []TrainingTrait `json:"traits"` }
TrainingResponse - https://wit.ai/docs/http/20200513/#post__utterances_link
type TrainingEntity ¶
type TrainingEntity struct { Entity string `json:"entity"` Start int `json:"start"` End int `json:"end"` Body string `json:"body"` Entities []TrainingEntity `json:"entities"` }
TrainingResponse - https://wit.ai/docs/http/20200513/#post__utterances_link
type TrainingResponse ¶
TrainingResponse - https://wit.ai/docs/http/20200513/#post__utterances_link
type TrainingTrait ¶
TrainingResponse - https://wit.ai/docs/http/20200513/#post__utterances_link
type Trait ¶
type Trait struct { ID string `json:"id"` Name string `json:"name"` Values []TraitValue `json:"values"` }
Trait - represents a wit-ai trait.
type TraitValue ¶
TraitValue - represents the value of a Trait.
type UpdateAppTagRequest ¶
type UpdateAppTagRequest struct { Tag string `json:"tag,omitempty"` Desc string `json:"desc,omitempty"` MoveTo string `json:"move_to,omitempty"` }
UpdateAppTagRequest - https://wit.ai/docs/http/20200513/#put__apps__app_tags__tag_link
type UpdateAppTagResponse ¶
type UpdateAppTagResponse struct { Tag string `json:"tag,omitempty"` Desc string `json:"desc,omitempty"` MovedTo string `json:"moved_to,omitempty"` }
UpdateAppTagResponse - https://wit.ai/docs/http/20200513/#put__apps__app_tags__tag_link
type Utterance ¶
type Utterance struct { Text string `json:"text"` Intent UtteranceIntent `json:"intent"` Entities []UtteranceEntity `json:"entities"` Traits []UtteranceTrait `json:"traits"` }
Utterance - https://wit.ai/docs/http/20200513/#get__utterances_link
type UtteranceEntity ¶
type UtteranceEntity struct { ID string `json:"id"` Name string `json:"name"` Role string `json:"role"` Start int `json:"start"` End int `json:"end"` Body string `json:"body"` Entities []UtteranceEntity `json:"entities"` }
UtteranceEntity - https://wit.ai/docs/http/20200513/#get__utterances_link
type UtteranceIntent ¶
UtteranceIntent - https://wit.ai/docs/http/20200513/#get__utterances_link
type UtteranceTrait ¶
type UtteranceTrait struct { ID string `json:"id"` Name string `json:"name"` Value string `json:"value"` }
UtteranceTrait - https://wit.ai/docs/http/20200513/#get__utterances_link