npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@project-sunbird/open-speech-streaming-client

v1.0.10

Published

Streaming client library for EkStep open speech API

Downloads

248

Readme

Web Client library for Open Speech Streaming API

NPM package

This package contains the client library to provide real-time streaming functionality for Open Speech API https://open-speech-ekstep.github.io/asr_model_api/. It requires a Socket.io proxy to support it. Details of the proxy can be found https://github.com/Open-Speech-EkStep/speech-recognition-open-api-proxy.

Visit Speech Recognititon Streaming API for architecture and other details.

Table of Contents

Getting Started

How to Install

In Node.js

The preferred way to install the client SDK for Node.js is to use the npm package manager for Node.js. Run the following into a terminal window:

npm i @project-sunbird/open-speech-streaming-client

In React Native

To use the client SDK in a react native project, first install the SDK using npm:

npm i @project-sunbird/open-speech-streaming-client

Then within your application, you can reference the react native compatible version of the SDK with the following:

import { StreamingClient, SocketStatus } from '@project-sunbird/open-speech-streaming-client';

Quick Start

  1. Import the StreamingClient module and create an instance.

    
    import {StreamingClient,SocketStatus} from '@project-sunbird/open-speech-streaming-client'
    
    //Create instance of streaming client.
    const streamingClient= new StreamingClient();
    
  2. Connect to the streaming server with the url and the language required.

    
    
    //Connect to inferencing server
    const inferenceServerURL = '<inferencing-server-url>';
    const language = '<language>';  //(eg: 'en')
    
    streaming.connect(inferenceServerURL, language, function (action, id) {
        if (action === SocketStatus.CONNECTED) {
            // Once connection is succesful, start streaming
            streaming.startStreaming(function (transcript) {
                // transcript will give you the text which can be used further
                console.log('transcript:', transcript);
            }, (e) => {
                console.log("I got error", e);
            })
        } else if (action === SocketStatus.TERMINATED) {
            // Socket is closed and punctuation can be done after it.
        } else {
            //unexpected failures action on connect.
            console.log("Action", action, id);
        }
    })
    
  3. If punctuation needed in the client sdk, do the following: [Note: Use this inside the condition block(action === SocketStatus.TERMINATED)]

    streaming.punctuateText('<Text to punctuate>', '<punctuation-url>', (status, text) => {
        console.log("Punctuted Text:", text);
    }, (status, error) => {
        console.log("Failed to punctuate", status, error);
    });

Reference

SocketStatus has two possible states.CONNECTED and TERMINATED


Examples

This repo contains samples in examples directory.

React Example

Location: examples/react-example

This example has a React implementation of a streaming client. You can start example by npm start from inside examples/react-example.

By default, this examples will point to parent repo as SDK so make sure you have dependencies installed on parent project. You can change to point npm by updating package.json

Getting Help

The best way to interact with our team is through GitHub. Please open an issue in github.