Skip to content

Commit f5633ad

Browse files
committed
Revert "test"
This reverts commit a0682dc. Commit a0682d contains numerous bits and pieces that shouldn't have been published, so I'm reverting it.
1 parent c55dec8 commit f5633ad

22 files changed

+132
-108
lines changed

README.rst

-3
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@ pip:
142142
143143
pip install dragonfly
144144
145-
146-
### TODO Update this section to mention release candidates and link to both RTD stable/latest builds ###
147-
148145
If you are installing this on Linux, you will also need to install the
149146
`wmctrl <https://www.freedesktop.org/wiki/Software/wmctrl/>`__, `xdotool
150147
<https://www.semicomplete.com/projects/xdotool/>`__ and `xsel

documentation/ccr.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ a few projects using dragonfly which make writing CCR rules easier:
2323
(`documentation <https://dragonfluid.readthedocs.io>`__)
2424
--- dragonfluid has drop-in replacements for dragonfly's element, grammar
2525
and rule classes that support CCR. The documentation has more information
26-
on this.
26+
on this. You should be able to use `dragonfluid` with `dragonfly2` by
27+
installing it without dependencies:
28+
29+
.. code:: shell
30+
31+
pip install --no-deps dragonfluid
2732

2833
- `dragonfly-scripts
2934
<https://github.com/dictation-toolbox/dragonfly-scripts/>`__

documentation/faq.txt

+30-9
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ Dragonfly supports the following speech recognition (SR) engines:
4141
work too.
4242
* :ref:`Windows Speech Recognition <RefSapi5Engine>` (WSR), included with
4343
Microsoft Windows Vista, Windows 7+, and freely available for Windows XP.
44-
* :ref:`Kaldi <RefKaldiEngine>`, open source (AGPL) and multi-platform.
45-
* :ref:`CMU Pocket Sphinx <RefSphinxEngine>`, open source and
46-
multi-platform.
44+
* :ref:`Kaldi <RefKaldiEngine>`
45+
* :ref:`CMU Pocket Sphinx <RefSphinxEngine>`
4746

4847
Dragonfly has cross platform support for Windows, macOS and Linux
4948
(X11-only). The following table shows which engines are available on which
@@ -66,7 +65,9 @@ using Dragonfly voice macros on remote hosts.
6665
Dragonfly's X11 support is dependent on the external *xdotool*, *wmctrl*
6766
and *xsel* programs. These programs are available for most Linux
6867
distributions. They are also available for other operating systems, such as
69-
FreeBSD.
68+
FreeBSD. At present, since *xdotool* is not available for it, Dragonfly
69+
will not work properly in a Cygwin environment.
70+
7071

7172
Where can I find examples Dragonfly command modules?
7273
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -80,18 +81,25 @@ example command modules in `dragonfly/examples`_.
8081
What is the difference between dragonfly and dragonfly2?
8182
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8283

83-
The names *dragonfly* and *dragonfly2* are two distribution names for the
84-
same package. They are now synonymous as of version 1.0.0 of the library.
85-
Prior to that version, *dragonfly2* was the distribution name since 2008.
84+
*Dragonfly* is the `original project`_ written by Christo Butcher. It is no
85+
longer maintained. *Dragonfly2* is a `fork`_ of Dragonfly that uses a
86+
different *distribution* name.
8687

8788
It is important to note that the *import name* is still "dragonfly":
8889

8990
.. code-block:: python
9091

9192
from dragonfly import Grammar, MappingRule, Key, Text, Mouse, Dictation
9293

93-
Dragonfly2 started out as a backwards-compatible continuation of the
94-
original project written by Christo Butcher.
94+
Dragonfly2 is intended to be backwards-compatible continuation of the
95+
original project. Many problems are fixed in this version. It supports
96+
alternative speech recognition engine backends (e.g. the
97+
:ref:`Kaldi engine <RefKaldiEngine>`), works with Python 3 and has
98+
cross-support for macOS and the X Window System (X11). Dragonfly2 also has
99+
some new features not found in the old version.
100+
101+
See the :ref:`changelog <RefChangelog>` for the full list of changes between
102+
the two versions.
95103

96104

97105
How can I use older Dragonfly scripts written for Python 2.7?
@@ -120,6 +128,19 @@ end:
120128

121129
The `Python 2-3 code porting guide`_ may also be of interest.
122130

131+
A number of older Dragonfly command modules also include the following code:
132+
133+
.. code-block:: python
134+
135+
try:
136+
import pkg_resources
137+
pkg_resources.require("dragonfly >= 0.6.5")
138+
except ImportError:
139+
pass
140+
141+
Since the distribution name has been changed to *dragonfly2*,
142+
:code:`dragonfly` will need to be replaced with :code:`dragonfly2`.
143+
123144

124145
Where are some good resources on learning Python?
125146
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

documentation/kaldi_engine.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ distributions, you can get them by running::
110110

111111
sudo apt install wmctrl xdotool xsel
112112

113-
Dragonfly only supports the X window system (X11) on Linux. You may also
114-
need to manually set the ``DISPLAY`` environment variable.
113+
You may also need to manually set the ``DISPLAY`` environment
114+
variable.
115115

116116
Once the dependencies and model are installed, you're ready to go!
117117

documentation/language.txt

+50-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11

2-
.. _RefLanguage:
3-
4-
Language sub-package
2+
Spoken Language Support
53
============================================================================
64

75
This section documents Dragonfly's support for spoken languages.
86

9-
TODO Move engine-specific sections into the relevant engine pages.
10-
TODO Document the languages Split this file and the documentation for dragonfly.language.
117

128
Languages with speech recognition engine support
139
----------------------------------------------------------------------------
@@ -31,18 +27,59 @@ U.S. English and U.K. English will both yield :code:`"en"` and be treated as
3127
the same language, even though there are some differences.
3228

3329

30+
Languages supported by Dragon
31+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+
33+
The following languages are supported by *Dragon Professional Individual*
34+
version 15 [#f1]_:
35+
36+
* English (multiple variants)
37+
* Dutch
38+
* French
39+
* German
40+
* Italian
41+
* Spanish
42+
43+
Please check the linked Nuance knowledgebase page for the languages
44+
supported by other versions and editions of Dragon.
45+
46+
47+
Languages supported by Windows Speech Recognition
48+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49+
50+
The following languages are supported by Windows Speech Recognition (WSR) as
51+
of 2016 [#f2]_:
52+
53+
* English (U.S.) (*)
54+
* English (U.K.)
55+
* Chinese (Simplified) (*)
56+
* Chinese (Traditional)
57+
* French (France)
58+
* German (Germany)
59+
* Japanese
60+
* Spanish (Spain)
61+
62+
\* Successfully tested.
63+
64+
Microsoft does not appear to be documenting the languages available for WSR
65+
any more, which is why the provided citation for this section is an
66+
archive.org link. Currently, the best way to find out if your language is
67+
supported is to look for available speech models in the Windows language
68+
settings: **Settings** > **Time & Language** > **Language**.
69+
70+
3471
Languages supported by CMU Pocket Sphinx
35-
----------------------------------------------------------------------------
72+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3673

3774
The CMU Pocket Sphinx engine documentation page has a section on
3875
:ref:`spoken language support <RefSphinxSpokenLanguageSupport>`. There are
3976
CMU Pocket Sphinx models and dictionaries available from Source Forge for
4077
the following languages [#f3]_:
4178

42-
* English (U.S.)
79+
* English (U.S.) (*)
4380
* English (Indian)
4481
* Catalan
45-
* Chinese (Mandarin)
82+
* Chinese (Mandarin) (*)
4683
* Dutch
4784
* French
4885
* German
@@ -51,14 +88,16 @@ the following languages [#f3]_:
5188
* Italian
5289
* Kazakh
5390
* Portuguese
54-
* Russian
91+
* Russian (*)
5592
* Spanish
5693

94+
\* Successfully tested.
95+
5796
English (U.S.) is the default language used by the CMU Pocket Sphinx engine.
5897

5998

6099
Languages supported by Kaldi
61-
----------------------------------------------------------------------------
100+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62101

63102
The following languages are supported by the :ref:`RefKaldiEngine`:
64103

@@ -97,7 +136,7 @@ English has additional time, date and character related classes.
97136

98137

99138
Language classes reference
100-
----------------------------------------------------------------------------
139+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101140

102141
.. automodule:: dragonfly.language.en.short_number
103142
:members:

documentation/make.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pushd %~dp0
55
REM Command file for Sphinx documentation
66

77
if "%SPHINXBUILD%" == "" (
8-
set SPHINXBUILD=py.exe -3 -msphinx
8+
set SPHINXBUILD=python -msphinx
99
)
1010
set SOURCEDIR=.
1111
set BUILDDIR=build

documentation/natlink_engine.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ Please see the `Natlink install instructions
4040
it.
4141

4242
A 32-bit Python installation is required to use this engine back-end. This
43-
is because Natlink does not work with 64-bit Python.
43+
is because Natlink does not work with 64-bit Python. This limitation is
44+
unlikely to be overcome.
4445

4546

4647
Post-install Use

documentation/tests.txt

+5
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ command:
125125
python setup.py test --test-suite=sapi5inproc
126126

127127

128+
Some SAPI 5 engine tests will fail intermittently, particularly with
129+
the shared process engine class (``"sapi5"`` / ``"sapi5shared"``).
130+
There is not much we can do about this.
131+
132+
128133
Using the Kaldi engine
129134
----------------------------------------------------------------------------
130135

dragonfly/__main__.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def make_arg_parser():
378378
)
379379
no_input_argument = _build_argument(
380380
"-n", "--no-input", default=False, action="store_true",
381-
help="Whether to load command modules and exit without "
381+
help="Whether to load command modules and then exit without "
382382
"reading input from stdin or recognizing speech."
383383
)
384384
log_level_argument = _build_argument(
@@ -466,7 +466,8 @@ def make_arg_parser():
466466

467467

468468
def main():
469-
# Parse the arguments and get the relevant function.
469+
# Parse the arguments and get the relevant function. Exit if the command
470+
# is not implemented.
470471
args = make_arg_parser().parse_args()
471472

472473
def not_implemented(_):
@@ -475,9 +476,10 @@ def not_implemented(_):
475476

476477
func = _COMMAND_MAP.get(args.command, not_implemented)
477478

478-
# Call the command function and return the exit code.
479-
return func(args)
479+
# Call the function and exit using the result.
480+
return_code = func(args)
481+
exit(return_code)
480482

481483

482484
if __name__ == '__main__':
483-
exit(main())
485+
main()

dragonfly/actions/keyboard/_x11_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
from dragonfly.actions.keyboard._base import (BaseKeyboard, BaseTypeable,
2727
BaseKeySymbols)
28-
# TODO Cleanup this file a little.
28+
2929

3030
KEY_TRANSLATION = {
3131
# Dragonfly references character keys as characters internally.

dragonfly/engines/backend_natlink/engine.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def disconnect(self):
178178
for grammar in self.grammars:
179179
grammar.unload()
180180

181-
# Close the waitForSpeech() dialog box if it is active for this
181+
# Close the the waitForSpeech() dialog box if it is active for this
182182
# process.
183183
from dragonfly import Window
184184
target_title = "Natlink / Python Subsystem"

dragonfly/engines/backend_sapi5/engine.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ def _load_grammar(self, grammar):
132132
# the grammar wrapper object for managing this grammar.
133133
context = self._recognizer.CreateRecoContext()
134134

135-
# Enable audio retention, if appropriate.
135+
# TODO Once audio retention is made modular, this block will need
136+
# to be exposed as an engine option "retain_audio". Otherwise,
137+
# as I understand it, audio retention won't work.
136138
if self._retain_dir:
137139
context.RetainedAudio = constants.SRAORetainAudio
138140

dragonfly/engines/backend_sphinx/engine.py

-2
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,6 @@ def _get_best_hypothesis(self, hypotheses):
674674
# Return the appropriate hypothesis.
675675
return hypotheses.get(hyp.hypstr, self._null_hypothesis)
676676

677-
# TODO I want to integrate this into an example command module.
678-
# It is a good example of how to use process_buffer().
679677
def process_wave_file(self, path):
680678
"""
681679
Recognize speech from a wave file and return the recognition

dragonfly/examples/_fruit_toggle.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ class AppleRule(CompoundRule):
3535
extras = [Dictation("text")]
3636
def _process_recognition(self, node, extras):
3737
print("I like apples! (%s)" % extras.get("text", ""))
38-
banana_rule.enable()
3938
apple_rule.disable()
39+
banana_rule.enable()
4040

4141
class BananaRule(CompoundRule):
4242
spec = "I like bananas [<text>]"
4343
extras = [Dictation("text")]
4444
def _process_recognition(self, node, extras):
4545
print("I like bananas! (%s)" % extras.get("text", ""))
46-
apple_rule.enable()
4746
banana_rule.disable()
47+
apple_rule.enable()
4848

4949
apple_rule = AppleRule()
5050
banana_rule = BananaRule()

dragonfly/examples/sphinx_wave_transcriber.py

+2-22
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,5 @@
1-
#
2-
# This file is part of Dragonfly.
3-
# (c) Copyright 2019 by Dane Finlay
4-
# Licensed under the LGPL.
5-
#
6-
# Dragonfly is free software: you can redistribute it and/or modify it
7-
# under the terms of the GNU Lesser General Public License as published
8-
# by the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# Dragonfly is distributed in the hope that it will be useful, but
12-
# WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14-
# Lesser General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU Lesser General Public
17-
# License along with Dragonfly. If not, see
18-
# <http://www.gnu.org/licenses/>.
19-
#
20-
211
"""
22-
Example script for recognizing speech from a wave file using the CMU Pocket
2+
Example script for recognising speech from a wave file using the CMU Pocket
233
Sphinx dragonfly engine.
244
255
"""
@@ -43,7 +23,7 @@ def main():
4323
engine = get_engine("sphinx")
4424

4525
# Voice activity detection config values may need to be adjusted to
46-
# recognize speech. Do this by changing the decoder's config.
26+
# recognise speech. Do this by changing the decoder's config.
4727
# Note that these values represent a number of audio frames, not time
4828
# intervals.
4929
# For example:

0 commit comments

Comments
 (0)