This sample is intended to demonstrate how to use the Nuance Websocket protocol in JavaScript.
You can perform 3 types of transactions with this protocol.
- Text to Speech (TTS)
- Automatic Speech Recognition (ASR)
- Natural Language Processing (NLU)
You will need credentials to connect to perform any of the 3 transactions types.
You can either enter your Nuance Developer credentials into the Web App.
Or you may edit configuration.js:
var URL = 'wss://ws.dev.nuance.com/?';
var APP_ID = undefined; // "NMDPTRIAL_username1234567890"
var APP_KEY = undefined; // "e77b5c751b94dddefc7d34bb5a4c44dc62199b5fd762da761974e36db57acecfcda31c8ad47946ccdca1516fa73476ebb46117c9a7124baeeb6e"
var USER_ID = undefined; // "[email protected]"
You may find your credentials in the Nuance Developers Portal, under "My Apps"
You will need a service tag to perform NLU.
Your tag can be entered in the Web App.
Or you may edit the following line in configuration.js:
var NLU_TAG = undefined; // "Project123_App456"
Note if you leave the tag empty, ASR will still be performed without NLU.
You can create versions of your NLU model and associate them to an application in Mix.nlu, on the "Publish" tab within your model.
Do not simply open index.html in a web browser. You will need to access it through a web server.
If you need a simple web server to get running quickly, you can use Python's SimpleHTTPServer.
Run the following from this directory, to run a server on port 8000 (you can use another port if you wish).
Python 2.x
python -m SimpleHTTPServer 8000
Python 3.x
python -m http.server --cgi 8000
You can then open the page in your browser by navigating to: