sdk

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

package sdk ASRT语音识别接口调用SDK

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeWav

func DecodeWav(waveByte []byte) (*common.Wav, error)

DecodeWav 从wave格式byte数组反序列化解码为Wav对象

func LoadFile

func LoadFile(filename string) []byte

LoadFile 加载二进制文件

Types

type BaseSpeechRecognizer

type BaseSpeechRecognizer struct {
	// Host 主机域名或IP
	Host string
	// Port 主机端口号
	Port string
	// Protocol 网络协议
	Protocol string
}

BaseSpeechRecognizer ASRT语音识别SDK语音识别基类

type GRPCSpeechRecognizer added in v1.2.0

type GRPCSpeechRecognizer struct {
	BaseSpeechRecognizer
	Client grpcClient.AsrtGrpcServiceClient
	// contains filtered or unexported fields
}

NewGRPCSpeechRecognizer 调用ASRT语音识别系统HTTP+JSON协议接口的语音识别类

func NewGRPCSpeechRecognizer added in v1.2.0

func NewGRPCSpeechRecognizer(host string, port string, protocol string) *GRPCSpeechRecognizer

NewGRPCSpeechRecognizer 构造一个用于调用grpc+pb协议接口的语音识别类实例对象

func (*GRPCSpeechRecognizer) Close added in v1.2.0

func (g *GRPCSpeechRecognizer) Close()

func (*GRPCSpeechRecognizer) Recognite added in v1.2.0

func (g *GRPCSpeechRecognizer) Recognite(wavData []byte, frameRate int, channels int, byteWidth int,
) (*common.AsrtAPIResponse, error)

Recognite 调用ASRT语音识别

func (*GRPCSpeechRecognizer) RecogniteFile added in v1.2.0

func (g *GRPCSpeechRecognizer) RecogniteFile(filename string) ([]*common.AsrtAPIResponse, error)

RecogniteFile 调用ASRT语音识别来识别指定文件名的音频文件

func (*GRPCSpeechRecognizer) RecogniteLanguage added in v1.2.0

func (g *GRPCSpeechRecognizer) RecogniteLanguage(sequencePinyin []string) (*common.AsrtAPIResponse, error)

RecogniteLanguage 调用ASRT语音识别语言模型

func (*GRPCSpeechRecognizer) RecogniteLong added in v1.2.0

func (g *GRPCSpeechRecognizer) RecogniteLong(wavData []byte, frameRate int, channels int, byteWidth int,
) ([]*common.AsrtAPIResponse, error)

RecogniteLong 调用ASRT语音识别来识别长音频序列

func (*GRPCSpeechRecognizer) RecogniteSpeech added in v1.2.0

func (g *GRPCSpeechRecognizer) RecogniteSpeech(wavData []byte, frameRate int, channels int, byteWidth int,
) (*common.AsrtAPIResponse, error)

RecogniteSpeech 调用ASRT语音识别声学模型

func (*GRPCSpeechRecognizer) RecogniteStream added in v1.2.0

func (g *GRPCSpeechRecognizer) RecogniteStream(wavChannel <-chan *common.Wav,
	resultChannel chan<- *common.AsrtAPIResponse,
) error

RecogniteStream 调用ASRT语音识别来流式识别音频

type HTTPSpeechRecognizer added in v1.1.0

type HTTPSpeechRecognizer struct {
	BaseSpeechRecognizer
	// SubPath HTTP协议资源子路径,默认为""
	SubPath string
}

HTTPSpeechRecognizer 调用ASRT语音识别系统HTTP+JSON协议接口的语音识别类

func NewHTTPSpeechRecognizer added in v1.1.0

func NewHTTPSpeechRecognizer(host string, port string, protocol string, subPath string) *HTTPSpeechRecognizer

NewHTTPSpeechRecognizer 构造一个用于调用http+json协议接口的语音识别类实例对象

func (*HTTPSpeechRecognizer) Recognite added in v1.1.0

func (h *HTTPSpeechRecognizer) Recognite(wavData []byte, frameRate int, channels int, byteWidth int,
) (*common.AsrtAPIResponse, error)

Recognite 调用ASRT语音识别

func (*HTTPSpeechRecognizer) RecogniteFile added in v1.1.0

func (h *HTTPSpeechRecognizer) RecogniteFile(filename string) ([]*common.AsrtAPIResponse, error)

RecogniteFile 调用ASRT语音识别来识别指定文件名的音频文件

func (*HTTPSpeechRecognizer) RecogniteLanguage added in v1.1.0

func (h *HTTPSpeechRecognizer) RecogniteLanguage(sequencePinyin []string) (*common.AsrtAPIResponse, error)

RecogniteLanguage 调用ASRT语音识别语言模型

func (*HTTPSpeechRecognizer) RecogniteLong added in v1.2.0

func (h *HTTPSpeechRecognizer) RecogniteLong(wavData []byte, frameRate int, channels int, byteWidth int,
) ([]*common.AsrtAPIResponse, error)

RecogniteLong 调用ASRT语音识别来识别长音频序列

func (*HTTPSpeechRecognizer) RecogniteSpeech added in v1.1.0

func (h *HTTPSpeechRecognizer) RecogniteSpeech(wavData []byte, frameRate int, channels int, byteWidth int,
) (*common.AsrtAPIResponse, error)

RecogniteSpeech 调用ASRT语音识别声学模型

type ISpeechRecognizer

type ISpeechRecognizer interface {
	// Recognite 调用ASRT语音识别
	Recognite(wavData []byte, frameRate int, channels int, byteWidth int) (*common.AsrtAPIResponse, error)
	// RecogniteSpeech 调用ASRT语音识别声学模型
	RecogniteSpeech(wavData []byte, frameRate int, channels int, byteWidth int) (*common.AsrtAPIResponse, error)
	// RecogniteLanguage 调用ASRT语音识别语言模型
	RecogniteLanguage(sequencePinyin []string) (*common.AsrtAPIResponse, error)
	// RecogniteLong
	RecogniteLong(wavData []byte, frameRate int, channels int, byteWidth int) ([]*common.AsrtAPIResponse, error)
	// RecogniteFile 调用ASRT语音识别来识别指定文件名的音频文件
	RecogniteFile(filename string) ([]*common.AsrtAPIResponse, error)
}

ISpeechRecognizer ASRT语音识别SDK语音识别抽象接口

func GetSpeechRecognizer

func GetSpeechRecognizer(host string, port string, protocol string) ISpeechRecognizer

GetSpeechRecognizer 获取一个语音识别调用类实例对象

Jump to

Keyboard shortcuts

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