summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/g2p.py9
-rw-r--r--client/stt.py2
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)