Welcome to PyNuance’s documentation!¶
Installation¶
Dependencies¶
sudo apt-get install libsamplerate0-dev portaudio19-dev libspeexdsp-dev
Warning
Need validation
From Pypi¶
pip install pynuance
From Github¶
pip install -e https://github.com/titilambert/pynuance.git#egg=pynuance
Getting Started¶
Account Creation¶
Create a Nuance Developer Account here: https://developer.nuance.com/public/index.php?task=register
Check the box “Yes - request access” in the “Want Mix ?” box
Go to your email and activate it
Get your credentials (generate credentials.json file):
pynuance credentials -u USERNAME -p PASSWORD -c credentials.json
Then you can use TTS and STT features
To use NLU feature, you have to wait maximum 24 hours after the account creation
Usage¶
Download your cookies and creadentials¶
Get Cookies¶
To speed up Nuance websites requests, it’s recommended to download your cookies
pynuance cookies -u USERNAME -p PASSWORD -C cookies.json
This will store your cookies in cookies.json file
Get Credentials¶
Then download your credentials needed to use Nuance services
pynuance credentials -C cookies.json -c credentials.json
This will store your credentials in credentials.json file
Use Nuance services¶
Text To Speech¶
pynuance tts -c credentials.json -l en_US -v Allison -d speex -t "Hello World"
NLU¶
- Check if you have access to Nuance Mix
pynuance mix -C cookies.json check
If you got Your Mix account is activated, you can use NLU, you can use it !
- Create a new model
pynuance mix -C cookies.json model -m mymodel create -l en_US
- Upload your data
pynuance mix -C cookies.json model -m mymodel upload -M examples/example1_en-US.trsx
- Train your model
pynuance mix -C cookies.json model -m mymodel train
- Create a build
pynuance mix -C cookies.json model -m mymodel build create -N "My first Version"
- List builds
pynuance mix -C cookies.json model -m mymodel build list
Version | Status | Created at | Notes
1 | COMPLETED | 2017-07-30T19:17:55 | My first Version
- Attach build to the Sandbox app
pynuance mix -C cookies.json model -m mymodel build attach -T mytag
- Run NLU command
pynuance nlu -c credentials.json -l en_US -T mytag text -t "What time is it ?"
Note
For next NLU commands, only step 8 is required
Development¶
Create developer environment¶
virtualenv -p /usr/bin/python3 env
source env/bin/activate
pip install -r requirements.txt
pip install -r test_requirements.txt
python setup.py develop
Run tests¶
- ::
- source env/bin/activate pip install -r test_requirements.txt PYNUANCE_USERNAME=yourusername PYNUANCE_PASSWORD=yourpassword pytest –html=pytest/report.html –junit-xml=pytest/junit.xml –cov=pynuance/ –cov-report=term –cov-report=html:pytest/coverage/html –cov-report=xml:pytest/coverage/xml tests/
References¶
- https://github.com/NuanceDev/ndev-python-http-cli/issues/7
- https://github.com/Fadyazmy/harrawr/blob/master/wsclient.py
- https://developer.nuance.com/public/Help/SpeechKitFrameworkReference_Android/com/nuance/speechkit/RecognitionType.html
- https://github.com/lemonzi/VoCoMi/blob/master/nuance.py
- https://developer.nuance.com/public/Help/HttpInterface/HTTP_web_services_for_NCS_clients_1.0_programmer_s_guide.pdf
- http://nuancedev.github.io/samples/http/python/#overview
PyNuance developer documentation¶
pynuance package¶
Submodules¶
pynuance.__main__ module¶
pynuance.cli module¶
pynuance.credentials module¶
Manage Nuance credentials and cookies
-
pynuance.credentials.
get_credentials
(username=None, password=None, cookies_file=None)[source]¶ Get credentials from Nuance dev page
Login Dev and Mix Nuance web sites and save cookies to the disk
pynuance.logger module¶
pynuance.mix module¶
Provides functions to interacte with Nuance Mix Website
-
pynuance.mix.
create_model
(name, language, username=None, password=None, cookies_file=None)[source]¶ Create a new model in Nuance Mix.
-
pynuance.mix.
delete_model
(name, username=None, password=None, cookies_file=None)[source]¶ Delete a model from model name or model ID
-
pynuance.mix.
get_model
(name, username=None, password=None, cookies_file=None)[source]¶ Get model data from Nuance Mix Website
-
pynuance.mix.
get_model_id
(name, username=None, password=None, cookies_file=None)[source]¶ Get model ID from model name.
If name is already a model ID, this function can help to validate the existance of the model.
Raise if there are 2 or more models with the same name.
-
pynuance.mix.
list_models
(username=None, password=None, cookies_file=None)[source]¶ Get list of models/project from Nuance Mix.
-
pynuance.mix.
mix_activated
(username=None, password=None, cookies_file=None)[source]¶ Check if the account has access to Nuance Mix.
URL: https://developer.nuance.com/mix/nlu/#/models/
Returns: - True means Mix account activated.
- False means Mix is being created or not requested
Return type: bool
-
pynuance.mix.
model_build_attach
(name, build_version=None, context_tag='latest', username=None, password=None, cookies_file=None)[source]¶ Attach model version to a Nuance App
For now, only SandBoxApp is supported by pynuance
-
pynuance.mix.
model_build_create
(name, notes='', username=None, password=None, cookies_file=None)[source]¶ Create a new model build.
-
pynuance.mix.
model_build_list
(name, username=None, password=None, cookies_file=None)[source]¶ Return the list of all builds for a given model
pynuance.nlu module¶
pynuance.recorder module¶
pynuance.stt module¶
pynuance.tts module¶
pynuance.websocket module¶
Module defining abstractWebsocket class
-
class
pynuance.websocket.
AbstractWebsocketConnection
(url, logger)[source]¶ Bases:
object
WebSocket connection object to handle Nuance server communications
-
MSG_AUDIO
= 2¶
-
MSG_JSON
= 1¶
-
-
class
pynuance.websocket.
BadWebsocketConnection
(url, logger)[source]¶ Bases:
pynuance.websocket.AbstractWebsocketConnection
WebSocket connection object to handle Nuance server communications
-
class
pynuance.websocket.
WebsocketConnection
(url, logger)[source]¶ Bases:
pynuance.websocket.AbstractWebsocketConnection
Websocket client