简体   繁体   中英

Using the node.js google cloud speech to text, how can I get the status of a current job?

I managed to trigger a job with:

        const config = {
            languageCode: 'en-US',
            enableSpeakerDiarization: true,
            audioChannelCount: 2,
            enableSeparateRecognitionPerChannel: true,
            useEnhanced: true,
            profanityFilter: false,
            enableAutomaticPunctuation: true,
        };

        const audio = {
            uri: `gs://${filePath}`
        }

        const requestObj = {
            config: config,
            audio: audio
        }
        return speechClient.longRunningRecognize(requestObj)

I get back an object with a name . I want to use that with https://cloud.google.com/speech-to-text/docs/reference/rest/v1/LongRunningRecognizeMetadata (via the node.js package) to get the current status.

How do I do it?

return speechClient.longrunning.Operation()

Seems not to exist

Looks like you can do it with:

                return speechClient.operationsClient.getOperation({ name: googleName })

This is not super well documented

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM