Skip to main content

The GoogleASR incremental module for the retico framework

Project description

retico-googleasr

This project contains the incremental module for running Google Cloud ASR in a retico environment. Google ASR provides continuous speech recognition updates by updating the current prediction. As this is not in the correct format for incremental processing, the recognized speech gets incrementalized and only updates to the previous states are published. E.g.,

[UpdateType]        [text]             [stability]            [final]
UpdateType.ADD:     this               (0.8999999761581421) - False
UpdateType.ADD:     isn't a sentence   (0.8999999761581421) - False
UpdateType.REVOKE:  isn't a sentence   (0.8999999761581421) - False
UpdateType.ADD:     is a test sentence (0.0)                - True

Installing

To use the Automatic Speech Recognition module utilizing google cloud speech, you need to install the third-party package first.

For this, you may follow the first two steps of this tutorial.

Important is, that you create your Google Application Credentials json file and save the path to that file into the global variable GOOGLE_APPLICATION_CREDENTIALS (look for the "Before you begin" section on the tutorial page).

After that you can install the package with

$ pip install retico-googleasr

Documentation

Sadly, there is no proper documentation for retico-googleasr right now, but you can start using the GoogleASRModule like this:

from retico_core import *
from retico_googleasr import *


msg = []


def callback(update_msg):
    global msg
    for x, ut in update_msg:
        if ut == UpdateType.ADD:
            msg.append(x)
        if ut == UpdateType.REVOKE:
            msg.remove(x)
    txt = ""
    committed = False
    for x in msg:
        txt += x.text + " "
        committed = committed or x.committed
    print(" " * 80, end="\r")
    print(f"{txt}", end="\r")
    if committed:
        msg = []
        print("")


m1 = audio.MicrophoneModule()
m2 = GoogleASRModule("en-US")  # en-US or de-DE or ....
m3 = debug.CallbackModule(callback=callback)

m1.subscribe(m2)
m2.subscribe(m3)

network.run(m1)

print("Running")
input()

network.stop(m1)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

retico-googleasr-0.1.5.tar.gz (8.4 kB view details)

Uploaded Source

File details

Details for the file retico-googleasr-0.1.5.tar.gz.

File metadata

  • Download URL: retico-googleasr-0.1.5.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for retico-googleasr-0.1.5.tar.gz
Algorithm Hash digest
SHA256 dc4168048cccf599269ed36f3ce3fea9825020b0ca9e2ddad4751b297e077b69
MD5 7277b8ed03841bf2763646037edba0a2
BLAKE2b-256 7a70c7b1461338381049a1176ebd1c8278d3e8e720c61b9ba0bf68abf7101e62

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page