golami

package module
v0.0.0-...-d92025d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

README

golami

Go interfacing olami nli

OLAMI GOLANG

This is a repository that contains Golang code for using OLAMI HTTP APIs.

OLAMI website and documentation: http://olami.ai

Requirement

Go version > 1.6.

Usage

see cmd/golami/main.go

Documentation

Index

Constants

View Source
const (
	APIEndpointCN = "https://cn.olami.ai/cloudservice/api"
	APIEndpointTW = "https://tw.olami.ai/cloudservice/api"

	APIServiceSEG = "seg"
	APIServiceNLI = "nli"
	APIServiceASR = "asr"
)

constants

Variables

This section is empty.

Functions

This section is empty.

Types

type ASR

type ASR struct {
	Result       string
	SpeechStatus int `json:"speech_status"`
	Final        bool
	Status       int
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client type

func New

func New(appKey, appSecret string, options ...ClientOption) (*Client, error)

New returns a new olami client instance.

func (*Client) PostASR

func (client *Client) PostASR(ctx context.Context, r io.Reader) (*Result, error)

func (*Client) PostText

func (client *Client) PostText(ctx context.Context, service, text string) (*Result, error)

type ClientOption

type ClientOption func(*Client) error

ClientOption type

func WithHTTPClient

func WithHTTPClient(c *http.Client) ClientOption

WithHTTPClient function

func WithLocalization

func WithLocalization(location string) ClientOption

WithLocalization function

type DescObj

type DescObj struct {
	Result string
	Type   string `json:"type,omitempty"`
	Status jsonInt
}

type NLI

type NLI struct {
	DescObj DescObj `json:"desc_obj"`
	Type    string
}

type NLUResult

type NLUResult struct {
	NLI []NLI  `json:"nli,omitempty"`
	SEG string `json:"seg,omitempty"`
	ASR ASR    `json:"asr,omitempty"`
}

type Result

type Result struct {
	Data   NLUResult
	Status string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL