Permalink
..
Failed to load latest commit information.
keys cleaning up API, mofed recognizeStream over from node sdk Jan 25, 2016
static cleaning up descriptions Oct 3, 2017
.bowerrc switching example to use bower-installed library (still symlinked to … Feb 10, 2017
.cfignore
.eslintrc.js eslint activated with basic rules Mar 18, 2016
bower.json
manifest.yml set up automatic deployment of examples to bluemix Feb 10, 2017
package-lock.json support wdc 3.7.0 and add tests for access_token param Jul 17, 2018
package.json support wdc 3.7.0 and add tests for access_token param Jul 17, 2018
readme.md Update links Mar 30, 2017
server.js support wdc 3.7.0 and add tests for access_token param Jul 17, 2018
server.py updating examples to work with both python and node.js Mar 4, 2016
webpack.config.js simplifying webpack example to just use the express server Feb 8, 2017

readme.md

Watson Speech JavaScript SDK Examples

This folder has example Node.js and Python servers to generate auth tokens and several html files (in static/) with different examples of using the Speech SDK.

There are also a few audio files to test with in the static/ folder.

Prerequisite

Setup - Node.js

  1. cd into the examples/ directory and run npm install to grab dependencies (this automatically runs bower install)
  2. edit tts-token.js and stt-token.js to include your service credentials (or create a .env file)
  3. run npm start
  4. Open your browser to http://localhost:3000/ to see the examples.

Setup - Python

  1. cd into the examples/ directory and run pip install watson_developer_cloud flask (or easy_install...) to install python dependencies
  2. run bower install to install client-side dependencies
  3. edit server.py to include your service credentials (or create a .env file)
  4. run python server.py
  5. Open your browser to http://localhost:5000/ to see the examples.

Notes

  • The examples all use fetch (a modern promise-based replacement for XMLHttpRequest) to retrieve auth tokens. Most supported browsers include a native fetch implementation, but a pollyfill is included in the top-level module for older browsers.
  • The examples use a Node.js server to generate tokens. It doesn't have to be written in Node.js, but some server-side token generator is required. The SDK will not accept your service credentials directly, and you can not use them to generate a token client-side. SDKs are available for Node.js, Java, Python, and there is a REST API for use with other languages (or curl).
  • The Speech SDK may be used in browserify, Webpack, or as a standalone library. Most of the examples use the standalone version either installed via bower or symlinked to the root directory when developing locally.

More Examples