diff options
author | Clayton G. Hobbs <clay@lakeserv.net> | 2015-12-27 12:56:57 -0500 |
---|---|---|
committer | Clayton G. Hobbs <clay@lakeserv.net> | 2015-12-27 12:56:57 -0500 |
commit | 87c0a1bfe93ffbe7eb67c41ea2b46fd5a7c1ab28 (patch) | |
tree | fcdcd1506922f520bd305a09c0329ba909d5534a /recognizer.py | |
parent | 443883b6898f2a75e64d8d4797dd448ef3aeda70 (diff) |
Improved config/argument behaviour
The configuration file is now properly overridden by argument parsing. This was accomplished by loading the config file, then treating the specified options as a namespace for the ArgumentParser. This makes things from the config file get overridden iff they were specified on the command line (not simply from defaults set in the ArgumentParser).
Diffstat (limited to 'recognizer.py')
-rwxr-xr-x | recognizer.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/recognizer.py b/recognizer.py index 06a2b87..02424a8 100755 --- a/recognizer.py +++ b/recognizer.py @@ -3,16 +3,14 @@ # Copyright 2013 Jezra # Copyright 2015 Clayton G. Hobbs +import os.path +import sys + import gi gi.require_version('Gst', '1.0') from gi.repository import GObject, Gst GObject.threads_init() Gst.init(None) -import os.path -import sys - -# Define some global variables -this_dir = os.path.dirname(os.path.abspath(__file__)) class Recognizer(GObject.GObject): @@ -20,7 +18,7 @@ class Recognizer(GObject.GObject): 'finished' : (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (GObject.TYPE_STRING,)) } - def __init__(self, language_file, dictionary_file, src = None): + def __init__(self, language_file, dictionary_file, src=None): GObject.GObject.__init__(self) self.commands = {} if src: @@ -41,7 +39,7 @@ class Recognizer(GObject.GObject): bus.add_signal_watch() # Get the Auto Speech Recognition piece - asr=self.pipeline.get_by_name('asr') + asr = self.pipeline.get_by_name('asr') bus.connect('message::element', self.result) asr.set_property('lm', language_file) asr.set_property('dict', dictionary_file) |