🚀 DAY 4 OF LAUNCH WEEK:Introducing Socket Scanning for OpenVSX Extensions.Learn more →
Socket
Book a DemoInstallSign in
Socket

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

Package Overview
Dependencies
Maintainers
9
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Streaming client library for EkStep open speech API

Source
npmnpm
Version
1.0.5
Version published
Weekly downloads
101
48.53%
Maintainers
9
Weekly downloads
 
Created
Source

Client library for Open Speech API

This package contains a client lib to provide real-time streaming functionality for Open Speech API https://open-speech-ekstep.github.io/.

How to use it

Step 1: Install the package

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

Step 2: Connect to socket and stream

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

//Create instance of streaming client.
const streamingClient= new StreamingClient();

//Connect to inferencing server
streaming.connect('<inferencing-server-url>', 'en-IN'/* langugaue*/, 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);
    }
})

Punctuation

You can punctuate a text using the punctuation endpoint.

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

SocketStatus

SocketStatus has two possible states.CONNECTED and TERMINATED

Examples

This repo contains examples inside examples directory

React Example

Location: examples/react-example

This example has a React implementation of a streaming client which points to https://inference.vakyansh.in. 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

Keywords

streaming

FAQs

Package last updated on 03 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts