summaryrefslogtreecommitdiff
path: root/client/stt.py
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-10-08 20:49:42 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2014-10-08 20:49:42 +0200
commit8e501c465f0e5486d28a7e23a8e231e35ea1e6c1 (patch)
treec80514a2146ca03d7d41cf515f4f56a260d83d75 /client/stt.py
parent78f7570d6bb1248fb5abe8e2d9315e6654c009fe (diff)
downloadjasper-client-8e501c465f0e5486d28a7e23a8e231e35ea1e6c1.tar.gz
jasper-client-8e501c465f0e5486d28a7e23a8e231e35ea1e6c1.zip
Move STT engine docstrings into the class bodies
Diffstat (limited to 'client/stt.py')
-rw-r--r--client/stt.py75
1 files changed, 36 insertions, 39 deletions
diff --git a/client/stt.py b/client/stt.py
index 485f5d9..cb06117 100644
--- a/client/stt.py
+++ b/client/stt.py
@@ -12,10 +12,6 @@ import yaml
import jasperpath
import diagnose
-"""
-The default Speech-to-Text implementation which relies on PocketSphinx.
-"""
-
class TranscriptionMode:
NORMAL, KEYWORD, MUSIC = range(3)
@@ -43,6 +39,9 @@ class AbstractSTTEngine(object):
class PocketSphinxSTT(AbstractSTTEngine):
+ """
+ The default Speech-to-Text implementation which relies on PocketSphinx.
+ """
SLUG = 'sphinx'
@@ -173,37 +172,36 @@ class PocketSphinxSTT(AbstractSTTEngine):
def is_available(cls):
return diagnose.check_python_import('pocketsphinx')
-"""
-Speech-To-Text implementation which relies on the Google Speech API.
-
-This implementation requires a Google API key to be present in profile.yml
-To obtain an API key:
-1. Join the Chromium Dev group:
- https://groups.google.com/a/chromium.org/forum/?fromgroups#!forum/chromium-dev
-2. Create a project through the Google Developers console:
- https://console.developers.google.com/project
-3. Select your project. In the sidebar, navigate to "APIs & Auth." Activate
- the Speech API.
-4. Under "APIs & Auth," navigate to "Credentials." Create a new key for public
- API access.
-5. Add your credentials to your profile.yml. Add an entry to the 'keys' section
- using the key name 'GOOGLE_SPEECH.' Sample configuration:
-6. Set the value of the 'stt_engine' key in your profile.yml to 'google'
+class GoogleSTT(AbstractSTTEngine):
+ """
+ Speech-To-Text implementation which relies on the Google Speech API.
+ This implementation requires a Google API key to be present in profile.yml
-Excerpt from sample profile.yml:
+ To obtain an API key:
+ 1. Join the Chromium Dev group:
+ https://groups.google.com/a/chromium.org/forum/?fromgroups#!forum/chromium-dev
+ 2. Create a project through the Google Developers console:
+ https://console.developers.google.com/project
+ 3. Select your project. In the sidebar, navigate to "APIs & Auth." Activate
+ the Speech API.
+ 4. Under "APIs & Auth," navigate to "Credentials." Create a new key for
+ public API access.
+ 5. Add your credentials to your profile.yml. Add an entry to the 'keys'
+ section using the key name 'GOOGLE_SPEECH.' Sample configuration:
+ 6. Set the value of the 'stt_engine' key in your profile.yml to 'google'
- ...
- timezone: US/Pacific
- stt_engine: google
- keys:
- GOOGLE_SPEECH: $YOUR_KEY_HERE
-"""
+ Excerpt from sample profile.yml:
+ ...
+ timezone: US/Pacific
+ stt_engine: google
+ keys:
+ GOOGLE_SPEECH: $YOUR_KEY_HERE
-class GoogleSTT(AbstractSTTEngine):
+ """
SLUG = 'google'
@@ -276,17 +274,6 @@ class GoogleSTT(AbstractSTTEngine):
def is_available(cls):
return diagnose.check_network_connection()
-"""
-Returns a Speech-To-Text engine.
-
-Currently, the supported implementations are the default Pocket Sphinx and
-the Google Speech API
-
-Arguments:
-engine_type - one of "sphinx" or "google"
-kwargs - keyword arguments passed to the constructor of the STT engine
-"""
-
def get_engines():
return [stt_engine for stt_engine in AbstractSTTEngine.__subclasses__()
@@ -294,6 +281,16 @@ def get_engines():
def newSTTEngine(stt_engine, **kwargs):
+ """
+ Returns a Speech-To-Text engine.
+
+ Currently, the supported implementations are the default Pocket Sphinx and
+ the Google Speech API
+
+ Arguments:
+ engine_type -- one of "sphinx" or "google"
+ kwargs -- keyword arguments passed to the constructor of the STT engine
+ """
selected_engines = filter(lambda engine: hasattr(engine, "SLUG") and
engine.SLUG == stt_engine, get_engines())
if len(selected_engines) == 0: