baidu

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACCESS_TOKEN_URL     = "https://aip.baidubce.com/oauth/2.0/token"
	ASR_ACCESS_TOKEN_URL = "https://openapi.baidu.com/oauth/2.0/token"
	IDCARD_URL           = "https://aip.baidubce.com/rest/2.0/ocr/v1/idcard"
	ASR_SPEED_URL        = "http://vop.baidu.com/server_api"
)
View Source
const (
	MGOCR_RETURN_ERRCODE_KEY      = "errors"
	MGOCR_RETURN_ERRMSG_KEY       = "error_description"
	MGOCR_RETURN_ACCESS_TOKEN_KEY = "access_token"
	MGOCR_RETURN_WORDS_RESULT_KEY = "words_result"
)
View Source
const (
	MGASR_RETURN_RESULT_KEY  = "result"
	MGASR_RETURN_ERR_NO_KEY  = "err_no"
	MGASR_RETURN_ERR_MSG_KEY = "err_msg	"
)
View Source
const (
	AREA_CODE = `` /* 123311-byte string literal not displayed */
)

Variables

View Source
var (
	MXAI_PARAM_ERROR        = errors.New("request param errors")
	MXAI_ASR_ERROR          = errors.New("asr errors")
	MXAI_ASR_FAILURE        = errors.New("asr failure")
	MXAI_HTTP_REQUEST_ERROR = errors.New("http request errors")
	VOICE_RATE_16000        = 16000

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

	MGASR_ASR_FAILURE = 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