Cloud Speech to Text in Node.js sample use of model adaptation

Job ID: 32647452

Budget: $250 – $750 USD

In our node.js app, we have a Web Socket that becomes a subscriber to a Twilio audio stream. We have succeeded in switching on (via post) the stop and start recognition and are collecting transcript text from our google spech account.

.streamingRecognize(googleSpeechConfigRequest)
.on("error", (error) => {
...
})
.on("data", (data) => {
...

We have experimented with a static ConfigRequest:

const googleSpeechConfigRequest = {
config: {
encoding: "MULAW",
sampleRateHertz: 8000,
languageCode: "en-US",
"speechContexts":[ {
"phrases":[
{"value":"battalion","boost": 10},
{"value":"command","boost": 10},
{"value":"italian","boost": -10},
{"value":"Command to battalion","boost": 10},
]
}
]
},
singleUtterance: false,
interimResults: true
};

In the google doc for model adaptation:

https://cloud.google.com/speech-to-text/docs/adaptation-model#improve_transcription_using_a_phraseset

It shows creation of StaticPhraseSet and CustomClass and I assume there is some pathway to tell .streamingRecognize to use one of the "libraries" on the current recognize stream.

I have tried to use https://cloud.google.com/speech-to-text/docs/reference/rest/v1p1beta1/projects.locations.phraseSets/create but cannot resolve security issues in my posts.

I cannot provide a complete code working environment, my Node JS has a companion .net core/sql where Twilio meetings are initiated and the web socket stream into Node is only achieved if Twilio dials out to connect to the WSS. I can support and prefer to support a Zoom meet as a final integrate sample code and exercise it in the real app . In my node app there is a index.html with "hello world" buttons to invoke the posts to the functions above as a technology proof of concept.


Deliverables
In Node.JS for StaticPhraseSet , CustomClass and how to apply in .streamingRecognize

I wish to have sample code and your support for me to paste and have it work in my project (via zoom session).

For example your demonstration js file would have:

a Post listener for "createPhraseSet"
// "https://speech.googleapis.com/v1p1beta1/projects/project_id/locations/global/phraseSets"
// -d '{"phraseSetId": "test-phrase-set-1"}'

"addtoPhraseSet"
"getPhraseSet"

"createCustomClass"
"addtoCustomClass"
"getCustomClass"

So the scope is

the 6 functions above
plus syntax on how to attach a CustomClass or PhraseSet to a recognize request
a zoom based session to copy into my node.js app and see it work.
Related categories: Node.js Google Cloud Platform