wesleysui / WatsonSpeechPlugin

Watson Speech SDK Cordova Plugin for iOS and Android

Home Page:https://github.com/CognitiveBuild

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Watson Speech SDK Plugin for iOS and Android

Language: Objective-C Language: Java Language: JavaScript GitHub license

Installation

To install the Watson Speech Plugin in your Cordova Project, run in terminal:

cordova plugin add https://github.com/CognitiveBuild/WatsonSpeechPlugin.git

Credentials

  • iOS: Update your username/password of the Speech-to-Text and Text-to-Speech services in Credential.plist
  • Android: Update in Java code of the native Plugins

Basic JavaScript APIs

Speech-to-Text

WatsonSDK.SpeechToText.recognize(function(data){
    // data
    if(data.iscompleted === WatsonSDK.Constants.YES) {
        // connection closed, ready for another round of speech recognition
        return;
    }

    if(data.isfinal === WatsonSDK.Constants.YES) {
        // last transcript is returned, the WebSocket is automatically disconnected
    }
    // evaluate the transcription
    console.log(data.message);
}, function(error){
    // error
});

Text-to-Speech

var text = 'Hello World!';
WatsonSDK.TextToSpeech.synthesize(function(data){
    // success
}, function(error){
    // error
}, [text]);

Text-to-Speech with Customizations

var text = 'Hello World!';
var customization_id = 'your-customization-id';
WatsonSDK.TextToSpeech.synthesize(function(data){
    // success
}, function(error){
    // error
}, [text, customization_id]);

Uninstall

To uninstall the Watson Speech Plugin from your Corodva Project, run in terminal:

cordova plugin remove WatsonSpeechPlugin

License

Copyright 2017 GCG GBS CTO Office under the Apache 2.0 license.

About

Watson Speech SDK Cordova Plugin for iOS and Android

https://github.com/CognitiveBuild

License:Apache License 2.0


Languages

Language:Objective-C 72.5%Language:Java 22.5%Language:JavaScript 5.0%