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 Entity struct { ID string `json:"id"` Doc string `json:"doc"` Name string `json:"name,omitempty"` Lang string `json:"lang,omitempty"` Builtin bool `json:"builtin,omitempty"` Lookups []string `json:"lookups,omitempty"` Values []EntityValue `json:"values,omitempty"` }
Entity - https://wit.ai/docs/http/20170307#post__entities_link
type EntityValue ¶ added in v0.0.2
type EntityValue struct { Value string `json:"value"` Expressions []string `json:"expressions"` MetaData string `json:"metadata"` }
EntityValue - https://wit.ai/docs/http/20170307#get__entities__entity_id_link
type Locale ¶ added in v1.0.7
Locale - https://wit.ai/docs/http/20170307#get__language_link
type Locales ¶ added in v1.0.7
type Locales struct {
DetectedLocales []Locale `json:"detected_locales"`
}
Locales - https://wit.ai/docs/http/20170307#get__language_link
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"` }
Sample - https://wit.ai/docs/http/20170307#get__samples_link
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 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 ¶ 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