baidu

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessTokenURL    = "https://aip.baidubce.com/oauth/2.0/token"
	AsrAccessTokenURL = "https://openapi.baidu.com/oauth/2.0/token"
	IDCardURL         = "https://aip.baidubce.com/rest/2.0/ocr/v1/idcard"
	AsrSpeedURL       = "http://vop.baidu.com/server_api"
)
View Source
const (
	ReturnErrorCodeKey   = "errors"
	ReturnErrorMsgKey    = "error_description"
	ReturnAccessTokenKey = "access_token"
	ReturnWordsResultKey = "words_result"
	ReturnResultKey      = "result"
)
View Source
const (
	AreaCode = `` /* 123311-byte string literal not displayed */
)

Variables

View Source
var (
	MxAIParamError = errors.New("request param errors")

	VoiceRate16000 = 16000

	ContentTypeUrlencoded = "application/x-www-form-urlencoded"
	ContentTypeJson       = "application/json;charset=utf-8"
)
View Source
var (
	ErrIDCardInfoEmpty = errors.New("idCard info empty")

	ErrAsrFailure = errors.New("asr failure")
)

Functions

This section is empty.

Types

type IdCardFront

type IdCardFront struct {
	UserName   string `json:"user_name"`
	Sex        string `json:"sex"`
	IdNum      string `json:"id_num"`
	Nation     string `json:"nation"`
	BirthDay   string `json:"birth_date"`
	Address    string `json:"id_address"`
	BirthPlace string `json:"birth_place"`
}

type MGAi

type MGAi struct {
	AppId       string
	AppKey      string
	AppSecurity string
	Cuid        string
}

func (*MGAi) GetAccessToken

func (mg *MGAi) GetAccessToken() (token string, err error)

获取 Access Token

func (*MGAi) GetAsrAccessToken

func (mg *MGAi) GetAsrAccessToken() (token string, err error)

获取 Access Token

func (*MGAi) IdCardFront

func (mg *MGAi) IdCardFront(image, accessToken string) (idCardFront *IdCardFront, err error)

身份证(正面)识别 image-必填,图像数据,base64编码后进行urlencode,要求base64编码和urlencode后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式

func (*MGAi) Speech

func (mg *MGAi) Speech(speechData string, speechDataLen int64, format, token string) (content string, err error)

Jump to

Keyboard shortcuts

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