diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-12 17:58:33 -0400 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-12 17:58:33 -0400 |
| commit | fde1122750134e849a6c814d2e785b1252758b38 (patch) | |
| tree | f480b622c2c9a1871c08c539fd64f6791de8b0ed /client | |
| parent | c74b76df557c9063f66a4ca3193becae19ed4625 (diff) | |
| download | jasper-client-fde1122750134e849a6c814d2e785b1252758b38.tar.gz jasper-client-fde1122750134e849a6c814d2e785b1252758b38.zip | |
Minor style fixes in g2p.py and stt.py
Diffstat (limited to 'client')
| -rw-r--r-- | client/g2p.py | 9 | ||||
| -rw-r--r-- | client/stt.py | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/client/g2p.py b/client/g2p.py index 87e8b0d..276f681 100644 --- a/client/g2p.py +++ b/client/g2p.py @@ -10,7 +10,7 @@ PHONE_MATCH = re.compile(r'<s> (.*) </s>') FST_MODEL = None # Try to get fst_model from config -profile_path = os.path.join(os.path.dirname(__file__),'profile.yml') +profile_path = os.path.join(os.path.dirname(__file__), 'profile.yml') if os.path.exists(profile_path): with open(profile_path, 'r') as f: profile = yaml.safe_load(f) @@ -20,6 +20,7 @@ if os.path.exists(profile_path): if not FST_MODEL: FST_MODEL = os.environ['JASPER_HOME'] + "/phonetisaurus/g014b2b.fst" + def parseLine(line): return PHONE_MATCH.search(line).group(1) @@ -29,7 +30,8 @@ def parseOutput(output): def translateWord(word): - out = subprocess.check_output(['phonetisaurus-g2p', '--model=%s' % FST_MODEL, '--input=%s' % word]) + out = subprocess.check_output( + ['phonetisaurus-g2p', '--model=%s' % FST_MODEL, '--input=%s' % word]) return parseLine(out) @@ -47,7 +49,8 @@ def translateWords(words): def translateFile(input_filename, output_filename=None): - out = subprocess.check_output(['phonetisaurus-g2p', '--model=%s' % FST_MODEL, '--input=%s' % input_filename, '--words', '--isfile']) + out = subprocess.check_output( + ['phonetisaurus-g2p', '--model=%s' % FST_MODEL, '--input=%s' % input_filename, '--words', '--isfile']) out = parseOutput(out) if output_filename: diff --git a/client/stt.py b/client/stt.py index d012245..bcfdfba 100644 --- a/client/stt.py +++ b/client/stt.py @@ -36,7 +36,7 @@ class PocketSphinxSTT(object): hmm_dir = None # Try to get hmm_dir from config - profile_path = os.path.join(os.path.dirname(__file__),'profile.yml') + profile_path = os.path.join(os.path.dirname(__file__), 'profile.yml') if os.path.exists(profile_path): with open(profile_path, 'r') as f: profile = yaml.safe_load(f) |
