Last Modified: October 14, 2000
One of the goals of Natlink was to allow people to control Dragon NaturallySpeaking by writing Python scripts. In the Natlink package, I include two scripts which hint at some of the power of the NatLink system. Remember to refer to natlink.txt for more details on the NatLink functions used in these scripts.
In addition, I have developed a PowerPoint presentation, VoiceCoders.ppt, which describes how to use NatLink to replace Dragon NaturallySpeaking's dictation subsystem. Although I do not expect most people to go to that extreme, the presentation doe sinclude some useful information about how to control Dragon NaturallySpeaking from Python.
Trainuser.py is a Python program which uses NatLink to allow you to create and enroll a new user from recordings. Trainuser.py assumes that you have made recordings using the SaveWave program (which you will find in your c:\NatSpeak\programs directory). SaveWave creates recordings in NIST wave format (.nwv) where multiple utterances are save together in one file. SaveWave also save the transcripts in a companion file with a .lst extension.
In order to use trainuser.py, you must follow these steps:
- Create a set of recordings using SaveWave. The easiest way to do this is to run SaveWave after starting Dragon NaturallySpeaking and then use Dragon NaturallySpeaking normally. Do not forget to close SaveWave when you are done.
- You now have to correct the transcripts. Sometime in the near future, I will provide a transcript editor but for now you are on your own. In order for trainuser.py to work well the transcripts in your .lst files must reflect what you actually said, not what Dragon NaturallySpeaking recognized.
- At the beginning of trainuser.py (after the comments) are four variables which control what trainuser will do. You need to modify the values of those four variables for your purposes.
- username = the name of the new user you want trainuser.py to create.
- fileSpecs = the recording(s) you want to use to enroll your new user.
- baseModel = the type of acoustic model you want to use when you create the new user, this is the same string select when you use the New User Wizard.
- baseTopic = the type of language model you want to use when you create the new user, this is the same string select when you use the New User Wizard.
- Start Python and type the following commands:
Assuming everything is set up properly, trainuser will create a new Dragon NaturallySpeaking user for you and enroll that user on the recordings you supply. By the way, the recordings can be anything as long as you supply at least 18 minutes worth. You do not have to record Dave Barry or 3001.
Transcribe.py is a Python program which uses NatLink to transcribe a series of recordings made with the Dragon NaturallyMobile recorder. I write transcribe.py because I wanted to transcribe about 200 files which I recorded during my Grand Canyon raft trip. However, I did not want the transcriptions smashed together in one paragraph. Instead, I want each recording prefixed with the date and time the recording was made.
In order to use transcribe.py, you must follow these steps:
- Create a number of recording on the Dragon NaturallyMobile recorder.
- Use the Voice It Link program (which comes with Dragon NaturallySpeaking Mobile) to download all your recordings to one directory in compressed form. This creates a number of files with the .sri extensions.
- At the beginning of transcribe.py (after the comments) is one variable which indicates where the recordings are located. You need to modify the values of this variable for your purposes.
- fileSpecs = specification of the files you want to transcribe
- Start Dragon NaturallySpeaking. You must start Dragon NaturallySpeaking before running transcribe.py since transcribe.py needs to write to the Dragon NaturallySpeaking editor window.
- Start Python and type the following commands:
Assuming that everything is set up properly, transcribe.py should have Dragon NaturallySpeaking transcribe your recordings including the date and time prefix, directly into the Dragon NaturallySpeaking editor window.
I am supplying these sample programs as examples of how to use NatLink. Both trainuser.py and transcribe.py actually do something useful but they are not robust enough for general use. You should be somewhat familiar with Python and NatLink before you try to use these programs.
Refer to the file natlink.txt in the NatLinkSource directory. This file contains most of the documentation for NatLink functions.
This web page (http://www.synapseadaptive.com/joel/ControllingNatSpeak.html) was last modified on October 14, 2000.
The contents of this page are (c) Copyright 1998-1999 by Joel Gould. All Rights Reserved.
See Copyright Information for more details.