Joel Gould NaturallySpeaking Unofficial Information Pages
The Insider's Guide to Dragon NaturallySpeaking by Joel Gould
 Latest Product News
 Guide To Products
 Product Features
 Frequently Asked Questions
 Getting Best Performance
 Python Macro System
->     Intro To Python
    Intro To NatSpeak
    NatLink Copyright
    NatLink Installation
    NatLink Versions
    NatLink Contents
    Writing Python Macros
    Controlling NatSpeak
    Speech Enabled Python
    NatLink Support

Intro To Python

Last Modified: October 14, 2000

(Note: I have written two different introductions to NatLink, this page is written for NatSpeak users who want to know what this Python stuff is all about. The next page is written for Python users who want to know what this Dragon NaturallySpeaking thing is all about.)

What is Python?

Python is an interpreted, interactive, object-oriented programming language which has become increasing popular. Many people compare Python to Perl, and although Python can do most of the tasks that Perl can do, Python is richer and more powerful.

Python is available on most computing platforms, although only the Windows version is of interested to users of Dragon NaturallySpeaking. Python is copyrighted but is freely usable and distributable, even for commercial use.

Because Python is interpreted and because Python easily interfaces to other systems by using C extension modules, Python makes an ideal macro language for other programs, including Dragon NaturallySpeaking. It is relatively easy to learn and very powerful. And with NatLink, my interface between Python and Dragon NaturallySpeaking, you can use Python to write macros which are a lot more powerful and flexible than macros written using the build-in NatSpeak macro language.

You can learn all about Python from the main Python web site:

You will not have to become a Python expert in order to use Python as a macro language for Dragon NaturallySpeaking. I provide enough examples which you can modify that you should be able to get started with little or no trouble. But you will need to know the basics of Python so I recommend a book. There are two books which teach Python.

The book I recommend is called Learning Python (Mark Lutz, etc.). This is a newer book (which means that it is more up to date with the latest version of Python). It also seems to be better suited to learning the language from scratch.

The other big Python book is Programming Python (Mark Lutz). This is a larger, more through treatment of the language. But it is older so it is a little out of date in spots. It is also a little harder to get through since it covers more advanced topics.

One other Python book you may find interesting is Python Programming for Win32 (Mark Hammond, Andy Robinson). This book includes the details of how to use Python more effectively under Windows. It includes details about controlling Word, Excel, etc. from Python using OLE Automation, which you may find useful if you want to speech enable Windows applications.

What is NatLink?

NatLink is a C++ program which extends the Python programming language so you can access and control Dragon NaturallySpeaking directly from Python. NatLink is also a Dragon NaturallySpeaking compatibility module. This means that Dragon NaturallySpeaking will automatically load NatLink and use NatLink to communicate with one or more applications.

The term compatibility module is not very common but you have used them before. NaturalText is the most obvious compatibility module. It is automatically loaded when Dragon NaturallySpeaking starts and allows you to dictate into 3rd party applications by sending them keystrokes. NaturalText also contains the code which interprets macros from the global.dvc file. All built in macros, and any macros you write using the Professional Edition are executed using the NatLink compatibility module.

NatLink is another compatibility module like NaturalText. When installed, NatLink will allow you to load and recognize command grammars which are defined in one or more Python source files. Then, when your commands are recognized, your Python code is called to perform the appropriate actions.

NatLink does not replace NaturalText or Dragon NaturallySpeaking's built-in command and control system. Instead, NatLink coexists with it (as long as the command phrases you write in Python are different than the command phrases built-in to NatSpeak or added to your global.dvc file.)

In addition, using NatLink and writing your macros in Python has a number of advantages over writing your macros in the Dragon NaturallySpeaking native command and control language.

  • NatLink allows you to write macros with any version of Dragon NaturallySpeaking, not just the Professional version.
  • Commands you specify using NatLink can be much richer than the simple sentences that you are restricted to using with NatSpeak's native grammars. With the NatLink grammars, you can include optional words, alternative words, repeating words, nest other sentences in your command grammars and more.
  • NatLink allows you to create exclusive grammars which turn off all other grammars.
  • NatLink allows you to change which grammars are active at the start of every recognition based on (almost) any conditions you want.
  • Python is a much richer programming language for macros. You can do much more complex command processing in Python than you can do in Dragon's native grammar language.
  • With NatLink, you have multiple macros files. You are not restricted to having only one global.dvc.
  • With NatLink you can edit your macros with your favorite text editor and reload the changed macros into Dragon NaturallySpeaking without having to restart NatSpeak.

Of course there is a down side. Here are some things which you should be aware of if you decide to use NatLink and Python to write macros:

  • NatLink is not a supported product. There is no technical support. There may be bugs which I may not get around to fixing.
  • Although NatLink works with existing versions of Dragon NaturallySpeaking, and will probably work with the next version of Dragon NaturallySpeaking, there is no guarantee that NatLink will work with any future version of Dragon NaturallySpeaking.
  • The documentation is not as good as you would expect from a real product.
  • There is no fancy user interface. You will have to create macros by editing text files in your favorite text editor.
  • You will have to learn (at least some) Python to take advantage of NatLink.

More Details

I have given two PowerPoint presentations on the NatLink Python Macro System which you may find instructive.

The first presentation, NatLinkTalk.ppt, is an overview of how to use NatLink to write macros for Dragon NaturallySpeaking. It was first given to the Boston Voice Users group in the fall of 1999. Then I updated the talk a little and gave it to the Voice Coders group in June of 2000.

The second presentation, VoiceCoders.ppt, is more advanced. It describes how one could use NatLink and Python to replace the dictation components of Dragon NaturallySpeaking with their own dictation subsystem. Although I do not expect the average user to rewrite NatSpeak's dictation subsystem, the talk does include interesting technical details about how NatSpeak works which may be of interest to a broader audience.

That said, you are ready to move on. Skip the next topic which was written for Python programmers who need to learn about Dragon NaturallySpeaking and move ahead to NatLink Copyright.

This web page ( 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.

Web page hosting graciously provided by
Synapse, a provider of speech recognition solutions.