UNPKG

@aristech-org/stt-client

Version:

A Node.js client library for the Aristech Speech-to-Text API

1,379 lines 92.4 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.6.1 // protoc v5.28.3 // source: stt_service.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { makeGenericClientConstructor, } from "@grpc/grpc-js"; import { Duration } from "./google/protobuf/duration.js"; export const protobufPackage = "ari.stt.v1"; export var EndpointingType; (function (EndpointingType) { /** LM - Endpointing that considers the language model. */ EndpointingType[EndpointingType["LM"] = 0] = "LM"; /** VAD - VAD based endpointing. */ EndpointingType[EndpointingType["VAD"] = 1] = "VAD"; EndpointingType[EndpointingType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(EndpointingType || (EndpointingType = {})); export function endpointingTypeFromJSON(object) { switch (object) { case 0: case "LM": return EndpointingType.LM; case 1: case "VAD": return EndpointingType.VAD; case -1: case "UNRECOGNIZED": default: return EndpointingType.UNRECOGNIZED; } } export function endpointingTypeToJSON(object) { switch (object) { case EndpointingType.LM: return "LM"; case EndpointingType.VAD: return "VAD"; case EndpointingType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export var ModelType; (function (ModelType) { /** CORE_STT - STT-Core models */ ModelType[ModelType["CORE_STT"] = 0] = "CORE_STT"; /** GRAMMAR_STT - Grammar only models */ ModelType[ModelType["GRAMMAR_STT"] = 1] = "GRAMMAR_STT"; /** MULTITASK_STT - Multitask models */ ModelType[ModelType["MULTITASK_STT"] = 2] = "MULTITASK_STT"; /** DIARIZATION - Speaker diarization model type. */ ModelType[ModelType["DIARIZATION"] = 3] = "DIARIZATION"; ModelType[ModelType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(ModelType || (ModelType = {})); export function modelTypeFromJSON(object) { switch (object) { case 0: case "CORE_STT": return ModelType.CORE_STT; case 1: case "GRAMMAR_STT": return ModelType.GRAMMAR_STT; case 2: case "MULTITASK_STT": return ModelType.MULTITASK_STT; case 3: case "DIARIZATION": return ModelType.DIARIZATION; case -1: case "UNRECOGNIZED": default: return ModelType.UNRECOGNIZED; } } export function modelTypeToJSON(object) { switch (object) { case ModelType.CORE_STT: return "CORE_STT"; case ModelType.GRAMMAR_STT: return "GRAMMAR_STT"; case ModelType.MULTITASK_STT: return "MULTITASK_STT"; case ModelType.DIARIZATION: return "DIARIZATION"; case ModelType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export var GrammarType; (function (GrammarType) { /** * JSGF - JSGF grammar type. * Example grammar: `jsgf:<yes_no> = yes | no;` */ GrammarType[GrammarType["JSGF"] = 0] = "JSGF"; /** * SRGS - SRGS grammar type. * Example grammar: `srgs:$yes_no = yes | no;` */ GrammarType[GrammarType["SRGS"] = 3] = "SRGS"; /** * KWS - Keyword / Keyphrase spotting grammar type. * Example grammar: `kws:oh mighty computer|hey computer` */ GrammarType[GrammarType["KWS"] = 1] = "KWS"; /** * PHRASE_LIST - A simple json phrase list grammar type. * Example grammar: `["yes", "yeah", "yep", "why not", "no", "nope"]` */ GrammarType[GrammarType["PHRASE_LIST"] = 2] = "PHRASE_LIST"; GrammarType[GrammarType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(GrammarType || (GrammarType = {})); export function grammarTypeFromJSON(object) { switch (object) { case 0: case "JSGF": return GrammarType.JSGF; case 3: case "SRGS": return GrammarType.SRGS; case 1: case "KWS": return GrammarType.KWS; case 2: case "PHRASE_LIST": return GrammarType.PHRASE_LIST; case -1: case "UNRECOGNIZED": default: return GrammarType.UNRECOGNIZED; } } export function grammarTypeToJSON(object) { switch (object) { case GrammarType.JSGF: return "JSGF"; case GrammarType.SRGS: return "SRGS"; case GrammarType.KWS: return "KWS"; case GrammarType.PHRASE_LIST: return "PHRASE_LIST"; case GrammarType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export var RecognitionSpec_AudioEncoding; (function (RecognitionSpec_AudioEncoding) { /** AUDIO_ENCODING_UNSPECIFIED - If not specified, defaults to LINEAR16_PCM. */ RecognitionSpec_AudioEncoding[RecognitionSpec_AudioEncoding["AUDIO_ENCODING_UNSPECIFIED"] = 0] = "AUDIO_ENCODING_UNSPECIFIED"; /** LINEAR16_PCM - 16-bit signed little-endian (Linear PCM) */ RecognitionSpec_AudioEncoding[RecognitionSpec_AudioEncoding["LINEAR16_PCM"] = 1] = "LINEAR16_PCM"; RecognitionSpec_AudioEncoding[RecognitionSpec_AudioEncoding["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(RecognitionSpec_AudioEncoding || (RecognitionSpec_AudioEncoding = {})); export function recognitionSpec_AudioEncodingFromJSON(object) { switch (object) { case 0: case "AUDIO_ENCODING_UNSPECIFIED": return RecognitionSpec_AudioEncoding.AUDIO_ENCODING_UNSPECIFIED; case 1: case "LINEAR16_PCM": return RecognitionSpec_AudioEncoding.LINEAR16_PCM; case -1: case "UNRECOGNIZED": default: return RecognitionSpec_AudioEncoding.UNRECOGNIZED; } } export function recognitionSpec_AudioEncodingToJSON(object) { switch (object) { case RecognitionSpec_AudioEncoding.AUDIO_ENCODING_UNSPECIFIED: return "AUDIO_ENCODING_UNSPECIFIED"; case RecognitionSpec_AudioEncoding.LINEAR16_PCM: return "LINEAR16_PCM"; case RecognitionSpec_AudioEncoding.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export var NLPSpec_NlpInputField; (function (NLPSpec_NlpInputField) { /** UNSPECIFIED - If not specified, defaults to TEXT. */ NLPSpec_NlpInputField[NLPSpec_NlpInputField["UNSPECIFIED"] = 0] = "UNSPECIFIED"; /** TEXT - The text field is used as input for the nlp processing. */ NLPSpec_NlpInputField[NLPSpec_NlpInputField["TEXT"] = 1] = "TEXT"; /** TAGGED_TEXT - Use the tagged_text field as input for the nlp processing. */ NLPSpec_NlpInputField[NLPSpec_NlpInputField["TAGGED_TEXT"] = 2] = "TAGGED_TEXT"; /** SLOTTED_TEXT - Use the slotted_text field as input for the nlp processing. */ NLPSpec_NlpInputField[NLPSpec_NlpInputField["SLOTTED_TEXT"] = 3] = "SLOTTED_TEXT"; NLPSpec_NlpInputField[NLPSpec_NlpInputField["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(NLPSpec_NlpInputField || (NLPSpec_NlpInputField = {})); export function nLPSpec_NlpInputFieldFromJSON(object) { switch (object) { case 0: case "UNSPECIFIED": return NLPSpec_NlpInputField.UNSPECIFIED; case 1: case "TEXT": return NLPSpec_NlpInputField.TEXT; case 2: case "TAGGED_TEXT": return NLPSpec_NlpInputField.TAGGED_TEXT; case 3: case "SLOTTED_TEXT": return NLPSpec_NlpInputField.SLOTTED_TEXT; case -1: case "UNRECOGNIZED": default: return NLPSpec_NlpInputField.UNRECOGNIZED; } } export function nLPSpec_NlpInputFieldToJSON(object) { switch (object) { case NLPSpec_NlpInputField.UNSPECIFIED: return "UNSPECIFIED"; case NLPSpec_NlpInputField.TEXT: return "TEXT"; case NLPSpec_NlpInputField.TAGGED_TEXT: return "TAGGED_TEXT"; case NLPSpec_NlpInputField.SLOTTED_TEXT: return "SLOTTED_TEXT"; case NLPSpec_NlpInputField.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } function createBaseStreamingRecognitionRequest() { return { config: undefined, audioContent: undefined }; } export const StreamingRecognitionRequest = { encode(message, writer = new BinaryWriter()) { if (message.config !== undefined) { RecognitionConfig.encode(message.config, writer.uint32(10).fork()).join(); } if (message.audioContent !== undefined) { writer.uint32(18).bytes(message.audioContent); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseStreamingRecognitionRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.config = RecognitionConfig.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.audioContent = reader.bytes(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { config: isSet(object.config) ? RecognitionConfig.fromJSON(object.config) : undefined, audioContent: isSet(object.audioContent) ? bytesFromBase64(object.audioContent) : undefined, }; }, toJSON(message) { const obj = {}; if (message.config !== undefined) { obj.config = RecognitionConfig.toJSON(message.config); } if (message.audioContent !== undefined) { obj.audioContent = base64FromBytes(message.audioContent); } return obj; }, create(base) { return StreamingRecognitionRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseStreamingRecognitionRequest(); message.config = (object.config !== undefined && object.config !== null) ? RecognitionConfig.fromPartial(object.config) : undefined; message.audioContent = object.audioContent ?? undefined; return message; }, }; function createBaseStreamingRecognitionResponse() { return { chunks: [], clientId: "", language: "" }; } export const StreamingRecognitionResponse = { encode(message, writer = new BinaryWriter()) { for (const v of message.chunks) { SpeechRecognitionChunk.encode(v, writer.uint32(10).fork()).join(); } if (message.clientId !== "") { writer.uint32(26).string(message.clientId); } if (message.language !== "") { writer.uint32(34).string(message.language); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseStreamingRecognitionResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.chunks.push(SpeechRecognitionChunk.decode(reader, reader.uint32())); continue; } case 3: { if (tag !== 26) { break; } message.clientId = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.language = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { chunks: globalThis.Array.isArray(object?.chunks) ? object.chunks.map((e) => SpeechRecognitionChunk.fromJSON(e)) : [], clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", language: isSet(object.language) ? globalThis.String(object.language) : "", }; }, toJSON(message) { const obj = {}; if (message.chunks?.length) { obj.chunks = message.chunks.map((e) => SpeechRecognitionChunk.toJSON(e)); } if (message.clientId !== "") { obj.clientId = message.clientId; } if (message.language !== "") { obj.language = message.language; } return obj; }, create(base) { return StreamingRecognitionResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseStreamingRecognitionResponse(); message.chunks = object.chunks?.map((e) => SpeechRecognitionChunk.fromPartial(e)) || []; message.clientId = object.clientId ?? ""; message.language = object.language ?? ""; return message; }, }; function createBaseRecognitionConfig() { return { specification: undefined }; } export const RecognitionConfig = { encode(message, writer = new BinaryWriter()) { if (message.specification !== undefined) { RecognitionSpec.encode(message.specification, writer.uint32(10).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRecognitionConfig(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.specification = RecognitionSpec.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { specification: isSet(object.specification) ? RecognitionSpec.fromJSON(object.specification) : undefined }; }, toJSON(message) { const obj = {}; if (message.specification !== undefined) { obj.specification = RecognitionSpec.toJSON(message.specification); } return obj; }, create(base) { return RecognitionConfig.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseRecognitionConfig(); message.specification = (object.specification !== undefined && object.specification !== null) ? RecognitionSpec.fromPartial(object.specification) : undefined; return message; }, }; function createBaseRecognitionSpec() { return { audioEncoding: 0, sampleRateHertz: 0, locale: "", graph: "", grammar: "", partialResults: false, singleUtterance: false, normalization: undefined, phones: false, model: "", endpointing: undefined, vad: undefined, prompt: "", }; } export const RecognitionSpec = { encode(message, writer = new BinaryWriter()) { if (message.audioEncoding !== 0) { writer.uint32(8).int32(message.audioEncoding); } if (message.sampleRateHertz !== 0) { writer.uint32(16).int64(message.sampleRateHertz); } if (message.locale !== "") { writer.uint32(26).string(message.locale); } if (message.graph !== "") { writer.uint32(42).string(message.graph); } if (message.grammar !== "") { writer.uint32(50).string(message.grammar); } if (message.partialResults !== false) { writer.uint32(56).bool(message.partialResults); } if (message.singleUtterance !== false) { writer.uint32(64).bool(message.singleUtterance); } if (message.normalization !== undefined) { NormalizationSpec.encode(message.normalization, writer.uint32(74).fork()).join(); } if (message.phones !== false) { writer.uint32(80).bool(message.phones); } if (message.model !== "") { writer.uint32(90).string(message.model); } if (message.endpointing !== undefined) { EndpointSpec.encode(message.endpointing, writer.uint32(98).fork()).join(); } if (message.vad !== undefined) { VadSpec.encode(message.vad, writer.uint32(106).fork()).join(); } if (message.prompt !== "") { writer.uint32(114).string(message.prompt); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRecognitionSpec(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.audioEncoding = reader.int32(); continue; } case 2: { if (tag !== 16) { break; } message.sampleRateHertz = longToNumber(reader.int64()); continue; } case 3: { if (tag !== 26) { break; } message.locale = reader.string(); continue; } case 5: { if (tag !== 42) { break; } message.graph = reader.string(); continue; } case 6: { if (tag !== 50) { break; } message.grammar = reader.string(); continue; } case 7: { if (tag !== 56) { break; } message.partialResults = reader.bool(); continue; } case 8: { if (tag !== 64) { break; } message.singleUtterance = reader.bool(); continue; } case 9: { if (tag !== 74) { break; } message.normalization = NormalizationSpec.decode(reader, reader.uint32()); continue; } case 10: { if (tag !== 80) { break; } message.phones = reader.bool(); continue; } case 11: { if (tag !== 90) { break; } message.model = reader.string(); continue; } case 12: { if (tag !== 98) { break; } message.endpointing = EndpointSpec.decode(reader, reader.uint32()); continue; } case 13: { if (tag !== 106) { break; } message.vad = VadSpec.decode(reader, reader.uint32()); continue; } case 14: { if (tag !== 114) { break; } message.prompt = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { audioEncoding: isSet(object.audioEncoding) ? recognitionSpec_AudioEncodingFromJSON(object.audioEncoding) : 0, sampleRateHertz: isSet(object.sampleRateHertz) ? globalThis.Number(object.sampleRateHertz) : 0, locale: isSet(object.locale) ? globalThis.String(object.locale) : "", graph: isSet(object.graph) ? globalThis.String(object.graph) : "", grammar: isSet(object.grammar) ? globalThis.String(object.grammar) : "", partialResults: isSet(object.partialResults) ? globalThis.Boolean(object.partialResults) : false, singleUtterance: isSet(object.singleUtterance) ? globalThis.Boolean(object.singleUtterance) : false, normalization: isSet(object.normalization) ? NormalizationSpec.fromJSON(object.normalization) : undefined, phones: isSet(object.phones) ? globalThis.Boolean(object.phones) : false, model: isSet(object.model) ? globalThis.String(object.model) : "", endpointing: isSet(object.endpointing) ? EndpointSpec.fromJSON(object.endpointing) : undefined, vad: isSet(object.vad) ? VadSpec.fromJSON(object.vad) : undefined, prompt: isSet(object.prompt) ? globalThis.String(object.prompt) : "", }; }, toJSON(message) { const obj = {}; if (message.audioEncoding !== 0) { obj.audioEncoding = recognitionSpec_AudioEncodingToJSON(message.audioEncoding); } if (message.sampleRateHertz !== 0) { obj.sampleRateHertz = Math.round(message.sampleRateHertz); } if (message.locale !== "") { obj.locale = message.locale; } if (message.graph !== "") { obj.graph = message.graph; } if (message.grammar !== "") { obj.grammar = message.grammar; } if (message.partialResults !== false) { obj.partialResults = message.partialResults; } if (message.singleUtterance !== false) { obj.singleUtterance = message.singleUtterance; } if (message.normalization !== undefined) { obj.normalization = NormalizationSpec.toJSON(message.normalization); } if (message.phones !== false) { obj.phones = message.phones; } if (message.model !== "") { obj.model = message.model; } if (message.endpointing !== undefined) { obj.endpointing = EndpointSpec.toJSON(message.endpointing); } if (message.vad !== undefined) { obj.vad = VadSpec.toJSON(message.vad); } if (message.prompt !== "") { obj.prompt = message.prompt; } return obj; }, create(base) { return RecognitionSpec.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseRecognitionSpec(); message.audioEncoding = object.audioEncoding ?? 0; message.sampleRateHertz = object.sampleRateHertz ?? 0; message.locale = object.locale ?? ""; message.graph = object.graph ?? ""; message.grammar = object.grammar ?? ""; message.partialResults = object.partialResults ?? false; message.singleUtterance = object.singleUtterance ?? false; message.normalization = (object.normalization !== undefined && object.normalization !== null) ? NormalizationSpec.fromPartial(object.normalization) : undefined; message.phones = object.phones ?? false; message.model = object.model ?? ""; message.endpointing = (object.endpointing !== undefined && object.endpointing !== null) ? EndpointSpec.fromPartial(object.endpointing) : undefined; message.vad = (object.vad !== undefined && object.vad !== null) ? VadSpec.fromPartial(object.vad) : undefined; message.prompt = object.prompt ?? ""; return message; }, }; function createBaseNormalizationSpec() { return { stripUnk: false, nlp: undefined }; } export const NormalizationSpec = { encode(message, writer = new BinaryWriter()) { if (message.stripUnk !== false) { writer.uint32(16).bool(message.stripUnk); } if (message.nlp !== undefined) { NLPSpec.encode(message.nlp, writer.uint32(34).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseNormalizationSpec(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 2: { if (tag !== 16) { break; } message.stripUnk = reader.bool(); continue; } case 4: { if (tag !== 34) { break; } message.nlp = NLPSpec.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { stripUnk: isSet(object.stripUnk) ? globalThis.Boolean(object.stripUnk) : false, nlp: isSet(object.nlp) ? NLPSpec.fromJSON(object.nlp) : undefined, }; }, toJSON(message) { const obj = {}; if (message.stripUnk !== false) { obj.stripUnk = message.stripUnk; } if (message.nlp !== undefined) { obj.nlp = NLPSpec.toJSON(message.nlp); } return obj; }, create(base) { return NormalizationSpec.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseNormalizationSpec(); message.stripUnk = object.stripUnk ?? false; message.nlp = (object.nlp !== undefined && object.nlp !== null) ? NLPSpec.fromPartial(object.nlp) : undefined; return message; }, }; function createBaseNLPSpec() { return { serverConfig: "", functions: [], partialResults: false, args: "", inputField: 0 }; } export const NLPSpec = { encode(message, writer = new BinaryWriter()) { if (message.serverConfig !== "") { writer.uint32(10).string(message.serverConfig); } for (const v of message.functions) { NLPFunctionSpec.encode(v, writer.uint32(18).fork()).join(); } if (message.partialResults !== false) { writer.uint32(24).bool(message.partialResults); } if (message.args !== "") { writer.uint32(34).string(message.args); } if (message.inputField !== 0) { writer.uint32(40).int32(message.inputField); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseNLPSpec(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.serverConfig = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.functions.push(NLPFunctionSpec.decode(reader, reader.uint32())); continue; } case 3: { if (tag !== 24) { break; } message.partialResults = reader.bool(); continue; } case 4: { if (tag !== 34) { break; } message.args = reader.string(); continue; } case 5: { if (tag !== 40) { break; } message.inputField = reader.int32(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { serverConfig: isSet(object.serverConfig) ? globalThis.String(object.serverConfig) : "", functions: globalThis.Array.isArray(object?.functions) ? object.functions.map((e) => NLPFunctionSpec.fromJSON(e)) : [], partialResults: isSet(object.partialResults) ? globalThis.Boolean(object.partialResults) : false, args: isSet(object.args) ? globalThis.String(object.args) : "", inputField: isSet(object.inputField) ? nLPSpec_NlpInputFieldFromJSON(object.inputField) : 0, }; }, toJSON(message) { const obj = {}; if (message.serverConfig !== "") { obj.serverConfig = message.serverConfig; } if (message.functions?.length) { obj.functions = message.functions.map((e) => NLPFunctionSpec.toJSON(e)); } if (message.partialResults !== false) { obj.partialResults = message.partialResults; } if (message.args !== "") { obj.args = message.args; } if (message.inputField !== 0) { obj.inputField = nLPSpec_NlpInputFieldToJSON(message.inputField); } return obj; }, create(base) { return NLPSpec.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseNLPSpec(); message.serverConfig = object.serverConfig ?? ""; message.functions = object.functions?.map((e) => NLPFunctionSpec.fromPartial(e)) || []; message.partialResults = object.partialResults ?? false; message.args = object.args ?? ""; message.inputField = object.inputField ?? 0; return message; }, }; function createBaseNLPFunctionSpec() { return { id: "", args: [] }; } export const NLPFunctionSpec = { encode(message, writer = new BinaryWriter()) { if (message.id !== "") { writer.uint32(10).string(message.id); } for (const v of message.args) { writer.uint32(18).string(v); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseNLPFunctionSpec(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.id = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.args.push(reader.string()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { id: isSet(object.id) ? globalThis.String(object.id) : "", args: globalThis.Array.isArray(object?.args) ? object.args.map((e) => globalThis.String(e)) : [], }; }, toJSON(message) { const obj = {}; if (message.id !== "") { obj.id = message.id; } if (message.args?.length) { obj.args = message.args; } return obj; }, create(base) { return NLPFunctionSpec.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseNLPFunctionSpec(); message.id = object.id ?? ""; message.args = object.args?.map((e) => e) || []; return message; }, }; function createBaseEndpointSpec() { return { silenceTimeout: 0, trailingSilenceHighProbability: 0, trailingSilenceOkProbability: 0, trailingSilenceNoEndpoint: 0, utteranceTimeout: 0, }; } export const EndpointSpec = { encode(message, writer = new BinaryWriter()) { if (message.silenceTimeout !== 0) { writer.uint32(13).float(message.silenceTimeout); } if (message.trailingSilenceHighProbability !== 0) { writer.uint32(21).float(message.trailingSilenceHighProbability); } if (message.trailingSilenceOkProbability !== 0) { writer.uint32(29).float(message.trailingSilenceOkProbability); } if (message.trailingSilenceNoEndpoint !== 0) { writer.uint32(37).float(message.trailingSilenceNoEndpoint); } if (message.utteranceTimeout !== 0) { writer.uint32(45).float(message.utteranceTimeout); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEndpointSpec(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 13) { break; } message.silenceTimeout = reader.float(); continue; } case 2: { if (tag !== 21) { break; } message.trailingSilenceHighProbability = reader.float(); continue; } case 3: { if (tag !== 29) { break; } message.trailingSilenceOkProbability = reader.float(); continue; } case 4: { if (tag !== 37) { break; } message.trailingSilenceNoEndpoint = reader.float(); continue; } case 5: { if (tag !== 45) { break; } message.utteranceTimeout = reader.float(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { silenceTimeout: isSet(object.silenceTimeout) ? globalThis.Number(object.silenceTimeout) : 0, trailingSilenceHighProbability: isSet(object.trailingSilenceHighProbability) ? globalThis.Number(object.trailingSilenceHighProbability) : 0, trailingSilenceOkProbability: isSet(object.trailingSilenceOkProbability) ? globalThis.Number(object.trailingSilenceOkProbability) : 0, trailingSilenceNoEndpoint: isSet(object.trailingSilenceNoEndpoint) ? globalThis.Number(object.trailingSilenceNoEndpoint) : 0, utteranceTimeout: isSet(object.utteranceTimeout) ? globalThis.Number(object.utteranceTimeout) : 0, }; }, toJSON(message) { const obj = {}; if (message.silenceTimeout !== 0) { obj.silenceTimeout = message.silenceTimeout; } if (message.trailingSilenceHighProbability !== 0) { obj.trailingSilenceHighProbability = message.trailingSilenceHighProbability; } if (message.trailingSilenceOkProbability !== 0) { obj.trailingSilenceOkProbability = message.trailingSilenceOkProbability; } if (message.trailingSilenceNoEndpoint !== 0) { obj.trailingSilenceNoEndpoint = message.trailingSilenceNoEndpoint; } if (message.utteranceTimeout !== 0) { obj.utteranceTimeout = message.utteranceTimeout; } return obj; }, create(base) { return EndpointSpec.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseEndpointSpec(); message.silenceTimeout = object.silenceTimeout ?? 0; message.trailingSilenceHighProbability = object.trailingSilenceHighProbability ?? 0; message.trailingSilenceOkProbability = object.trailingSilenceOkProbability ?? 0; message.trailingSilenceNoEndpoint = object.trailingSilenceNoEndpoint ?? 0; message.utteranceTimeout = object.utteranceTimeout ?? 0; return message; }, }; function createBaseVadSpec() { return { threshold: 0, trailingSilence: 0, minSpeech: 0 }; } export const VadSpec = { encode(message, writer = new BinaryWriter()) { if (message.threshold !== 0) { writer.uint32(13).float(message.threshold); } if (message.trailingSilence !== 0) { writer.uint32(21).float(message.trailingSilence); } if (message.minSpeech !== 0) { writer.uint32(29).float(message.minSpeech); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVadSpec(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 13) { break; } message.threshold = reader.float(); continue; } case 2: { if (tag !== 21) { break; } message.trailingSilence = reader.float(); continue; } case 3: { if (tag !== 29) { break; } message.minSpeech = reader.float(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { threshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0, trailingSilence: isSet(object.trailingSilence) ? globalThis.Number(object.trailingSilence) : 0, minSpeech: isSet(object.minSpeech) ? globalThis.Number(object.minSpeech) : 0, }; }, toJSON(message) { const obj = {}; if (message.threshold !== 0) { obj.threshold = message.threshold; } if (message.trailingSilence !== 0) { obj.trailingSilence = message.trailingSilence; } if (message.minSpeech !== 0) { obj.minSpeech = message.minSpeech; } return obj; }, create(base) { return VadSpec.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseVadSpec(); message.threshold = object.threshold ?? 0; message.trailingSilence = object.trailingSilence ?? 0; message.minSpeech = object.minSpeech ?? 0; return message; }, }; function createBaseSpeechRecognitionChunk() { return { alternatives: [], final: false, endOfUtterance: false }; } export const SpeechRecognitionChunk = { encode(message, writer = new BinaryWriter()) { for (const v of message.alternatives) { SpeechRecognitionAlternative.encode(v, writer.uint32(10).fork()).join(); } if (message.final !== false) { writer.uint32(16).bool(message.final); } if (message.endOfUtterance !== false) { writer.uint32(24).bool(message.endOfUtterance); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSpeechRecognitionChunk(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.alternatives.push(SpeechRecognitionAlternative.decode(reader, reader.uint32())); continue; } case 2: { if (tag !== 16) { break; } message.final = reader.bool(); continue; } case 3: { if (tag !== 24) { break; } message.endOfUtterance = reader.bool(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { alternatives: globalThis.Array.isArray(object?.alternatives) ? object.alternatives.map((e) => SpeechRecognitionAlternative.fromJSON(e)) : [], final: isSet(object.final) ? globalThis.Boolean(object.final) : false, endOfUtterance: isSet(object.endOfUtterance) ? globalThis.Boolean(object.endOfUtterance) : false, }; }, toJSON(message) { const obj = {}; if (message.alternatives?.length) { obj.alternatives = message.alternatives.map((e) => SpeechRecognitionAlternative.toJSON(e)); } if (message.final !== false) { obj.final = message.final; } if (message.endOfUtterance !== false) { obj.endOfUtterance = message.endOfUtterance; } return obj; }, create(base) { return SpeechRecognitionChunk.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseSpeechRecognitionChunk(); message.alternatives = object.alternatives?.map((e) => SpeechRecognitionAlternative.fromPartial(e)) || []; message.final = object.final ?? false; message.endOfUtterance = object.endOfUtterance ?? false; return message; }, }; function createBaseSpeechRecognitionAlternative() { return { text: "", slottedText: "", taggedText: "", nlpText: "", confidence: 0, words: [] }; } export const SpeechRecognitionAlternative = { encode(message, writer = new BinaryWriter()) { if (message.text !== "") { writer.uint32(10).string(message.text); } if (message.slottedText !== "") { writer.uint32(58).string(message.slottedText); } if (message.taggedText !== "") { writer.uint32(42).string(message.taggedText); } if (message.nlpText !== "") { writer.uint32(50).string(message.nlpText); } if (message.confidence !== 0) { writer.uint32(21).float(message.confidence); } for (const v of message.words) { WordInfo.encode(v, writer.uint32(26).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSpeechRecognitionAlternative(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.text = reader.string(); continue; } case 7: { if (tag !== 58) { break; } message.slottedText = reader.string(); continue; } case 5: { if (tag !== 42) { break; } message.taggedText = reader.string(); continue; } case 6: { if (tag !== 50) { break; } message.nlpText = reader.string(); continue; } case 2: { if (tag !== 21) { break; } message.confidence = reader.float(); continue; } case 3: { if (tag !== 26) { break; } message.words.push(WordInfo.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { text: isSet(object.text) ? globalThis.String(object.text) : "", slottedText: isSet(object.slottedText) ? globalThis.String(object.slottedText) : "", taggedText: isSet(object.taggedText) ? globalThis.String(object.taggedText) : "", nlpText: isSet(object.nlpText) ? globalThis.String(object.nlpText) : "", confidence: isSet(object.confidence) ? globalThis.Number(object.confidence) : 0, words: globalThis.Array.isArray(object?.words) ? object.words.map((e) => WordInfo.fromJSON(e)) : [], }; }, toJSON(message) { const obj = {}; if (message.text !== "") { obj.text = message.text; } if (message.slottedText !== "") { obj.slottedText = message.slottedText; } if (message.taggedText !== "") { obj.taggedText = message.taggedText; } if (message.nlpText !== "") { obj.nlpText = message.nlpText; } if (message.confidence !== 0) { obj.confidence = message.confidence; } if (message.words?.length) { obj.words = message.words.map((e) => WordInfo.toJSON(e)); } return obj; }, create(base) { return SpeechRecognitionAlternative.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseSpeechRecognitionAlternative(); message.text = object.text ?? ""; message.slottedText = object.slottedText ?? ""; message.taggedText = object.taggedText ?? ""; message.nlpText = object.nlpText ?? ""; message.confidence = object.confidence ?? 0; message.words = object.words?.map((e) => WordInfo.fromPartial(e)) || []; return message; }, }; function createBaseWordInfo() { return { startTime: undefined, endTime: undefined, word: "", confidence: 0, phones: [], slot: "" }; } export const WordInfo = { encode(message, writer = new BinaryWriter()) { if (message.startTime !== undefined) { Duration.encode(message.startTime, writer.uint32(10).fork()).join(); } if (message.endTime !== undefined) { Duration.encode(message.endTime, writer.uint32(18).fork()).join(); } if (message.word !== "") { writer.uint32(26).string(message.word); } if (message.confidence !== 0) { writer.uint32(37).float(message.confidence); } for (const v of message.phones) { PhoneI