Documentation
¶
Index ¶
- Constants
- type App
- type AppTrainingStatus
- type Client
- func (c *Client) AddEntityValue(entityID string, value EntityValue) (*Entity, error)
- func (c *Client) AddEntityValueExpression(entityID string, value string, expression string) (*Entity, error)
- func (c *Client) CreateApp(app App) (*CreatedApp, error)
- func (c *Client) CreateEntity(entity Entity) (*Entity, error)
- func (c *Client) DeleteApp(id string) error
- func (c *Client) DeleteEntity(id string) error
- func (c *Client) DeleteEntityRole(entityID string, role string) error
- func (c *Client) DeleteEntityValue(entityID string, value string) error
- func (c *Client) DeleteEntityValueExpression(entityID string, value string, expression string) error
- func (c *Client) DeleteSamples(samples []Sample) (*ValidateSampleResponse, 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) GetApps(limit int, offset int) ([]App, error)
- func (c *Client) GetEntities() ([]string, error)
- func (c *Client) GetEntity(id string) (*Entity, error)
- func (c *Client) GetSamples(limit int, offset int) ([]Sample, 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) UpdateApp(id string, app App) (*App, error)
- func (c *Client) UpdateEntity(id string, entity Entity) error
- func (c *Client) ValidateSamples(samples []Sample) (*ValidateSampleResponse, error)
- type CreatedApp
- type Entity
- type EntityValue
- type Locale
- type Locales
- type MessageContext
- type MessageCoords
- type MessageRequest
- type MessageResponse
- type Sample
- type SampleEntity
- type Speech
- type Time
- type ValidateSampleResponse
Constants ¶
const ( // DefaultVersion - https://wit.ai/docs/http/20170307 DefaultVersion = "20170307" // 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 ¶ added in v0.0.2
type App struct {
Name string `json:"name"`
Lang string `json:"lang"`
Private bool `json:"private"`
// Description presents when we get an app
Description string `json:"description,omitempty"`
// Use Desc when create an app
Desc string `json:"desc,omitempty"`
// ID presents when we get an app
ID string `json:"id,omitempty"`
// AppID presents when we create an app
AppID string `json:"app_id,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
Timezone string `json:"timezone,omitempty"`
// Training information
LastTrainingDurationSecs int `json:"last_training_duration_secs,omitempty"`
WillTrainAt Time `json:"will_train_at,omitempty"`
LastTrainedAt Time `json:"last_trained_at,omitempty"`
TrainingStatus AppTrainingStatus `json:"training_status,omitempty"`
}
type AppTrainingStatus ¶ added in v1.0.4
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 NewClientWithVersion ¶
NewClientWithVersion - returns Wit.ai client for specified API version
func (*Client) AddEntityValue ¶ added in v0.0.2
func (c *Client) AddEntityValue(entityID string, value EntityValue) (*Entity, error)
AddEntityValue - Add a possible value into the list of values for the keyword entity. https://wit.ai/docs/http/20170307#post__entities__entity_id_values_link
func (*Client) AddEntityValueExpression ¶ added in v0.0.2
func (c *Client) AddEntityValueExpression(entityID string, value string, expression string) (*Entity, error)
AddEntityValueExpression - Create a new expression of the canonical value of the keyword entity. https://wit.ai/docs/http/20170307#post__entities__entity_id_values__value_id_expressions_link
func (*Client) CreateApp ¶ added in v0.0.2
func (c *Client) CreateApp(app App) (*CreatedApp, error)
CreateApp - creates new app. https://wit.ai/docs/http/20170307#post__apps_link
func (*Client) CreateEntity ¶ added in v0.0.2
CreateEntity - Creates a new entity with the given attributes. https://wit.ai/docs/http/20170307#post__entities_link
func (*Client) DeleteApp ¶ added in v0.0.2
DeleteApp - deletes app by ID. https://wit.ai/docs/http/20170307#delete__apps__app_id_link
func (*Client) DeleteEntity ¶ added in v0.0.2
DeleteEntity - deletes entity by ID. https://wit.ai/docs/http/20170307#delete__entities__entity_id_link
func (*Client) DeleteEntityRole ¶ added in v0.0.2
DeleteEntityRole - deletes entity role. https://wit.ai/docs/http/20170307#delete__entities__entity_id_role_id_link
func (*Client) DeleteEntityValue ¶ added in v0.0.2
DeleteEntityValue - Delete a canonical value from the entity. https://wit.ai/docs/http/20170307#delete__entities__entity_id_values_link
func (*Client) DeleteEntityValueExpression ¶ added in v0.0.2
func (c *Client) DeleteEntityValueExpression(entityID string, value string, expression string) error
DeleteEntityValueExpression - Delete an expression of the canonical value of the entity. https://wit.ai/docs/http/20170307#delete__entities__entity_id_values__value_id_expressions_link
func (*Client) DeleteSamples ¶ added in v0.0.3
func (c *Client) DeleteSamples(samples []Sample) (*ValidateSampleResponse, error)
DeleteSamples - Delete validated samples from your app. https://wit.ai/docs/http/20170307#delete__samples_link Only text property is required
func (*Client) Detect ¶ added in v1.0.7
Detect - returns the detected languages from query - https://wit.ai/docs/http/20170307#get__language_link
func (*Client) Export ¶ added in v1.0.0
Export - Returns download URI. https://wit.ai/docs/http/20170307#get__export_link
func (*Client) GetApp ¶ added in v0.0.2
GetApp - returns map by ID. https://wit.ai/docs/http/20170307#get__apps__app_id_link
func (*Client) GetApps ¶ added in v0.0.2
GetApps - Returns an array of all apps that you own. https://wit.ai/docs/http/20170307#get__apps_link
func (*Client) GetEntities ¶ added in v0.0.2
GetEntities - returns list of entities. https://wit.ai/docs/http/20170307#get__entities_link
func (*Client) GetEntity ¶ added in v0.0.2
GetEntity - returns entity by ID. https://wit.ai/docs/http/20170307#get__entities__entity_id_link
func (*Client) GetSamples ¶ added in v0.0.3
GetSamples - Returns an array of samples. https://wit.ai/docs/http/20170307#get__samples_link
func (*Client) Parse ¶ added in v0.0.2
func (c *Client) Parse(req *MessageRequest) (*MessageResponse, error)
Parse - parses text and returns entities
func (*Client) SetHTTPClient ¶ added in v1.0.0
SetHTTPClient allows to use your custom http.Client
func (*Client) Speech ¶ added in v0.0.2
func (c *Client) Speech(req *MessageRequest) (*MessageResponse, error)
Speech - sends audio file for parsing
func (*Client) UpdateApp ¶ added in v0.0.2
UpdateApp - Updates an app. https://wit.ai/docs/http/20170307#put__apps__app_id_link
func (*Client) UpdateEntity ¶ added in v0.0.2
UpdateEntity - Updates an entity. https://wit.ai/docs/http/20170307#put__entities__entity_id_link
func (*Client) ValidateSamples ¶ added in v0.0.3
func (c *Client) ValidateSamples(samples []Sample) (*ValidateSampleResponse, error)
ValidateSamples - Validate samples (sentence + entities annotations) to train your app programmatically. https://wit.ai/docs/http/20170307#post__samples_link
type CreatedApp ¶ added in v1.0.1
CreatedApp - https://wit.ai/docs/http/20170307#post__apps_link
type Entity ¶ added in v0.0.2
type EntityValue ¶ added in v0.0.2
type Locales ¶ added in v1.0.7
type Locales struct {
DetectedLocales []Locale `json:"detected_locales"`
}
type MessageContext ¶ added in v0.0.2
type MessageContext struct {
TeferenceTime 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 ¶ added in v0.0.2
MessageCoords - https://wit.ai/docs/http/20170307#context_link
type MessageRequest ¶ added in v0.0.2
type MessageRequest struct {
Query string `json:"q"`
MsgID string `json:"msg_id"`
N int `json:"n"`
ThreadID string `json:"thread_id"`
Context *MessageContext `json:"context"`
Speech *Speech `json:"-"`
}
MessageRequest - https://wit.ai/docs/http/20170307#get__message_link
type MessageResponse ¶ added in v0.0.2
type MessageResponse struct {
ID string `json:"msg_id"`
Text string `json:"_text"`
Entities map[string]interface{} `json:"entities"`
}
MessageResponse - https://wit.ai/docs/http/20170307#get__message_link
type Sample ¶ added in v0.0.3
type Sample struct {
Text string `json:"text"`
Entities []SampleEntity `json:"entities"`
}
type SampleEntity ¶ added in v0.0.3
type SampleEntity struct {
Entity string `json:"entity"`
Value string `json:"value"`
Role string `json:"role"`
Start int `json:"start"`
End int `json:"end"`
Subentitites []SampleEntity `json:"subentities"`
}
SampleEntity - https://wit.ai/docs/http/20170307#get__samples_link
type Speech ¶ added in v0.0.2
type Time ¶ added in v1.0.8
Time - Custom type to encapsulated a time.Time
func (*Time) UnmarshalJSON ¶ added in v1.0.8
UnmarshalJSON - Our unmarshal function for our custom type
type ValidateSampleResponse ¶ added in v0.0.3
ValidateSampleResponse - https://wit.ai/docs/http/20170307#post__samples_link
