diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-10-06 16:59:36 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-10-06 16:59:36 +0200 |
| commit | edca8b7407d7c9b1497ba1722d1b66ffa4b4c234 (patch) | |
| tree | d544987379415ac557751401ea0b0c7de81530b7 /client/g2p.py | |
| parent | 890a5798fcf7f9b9dc06529aa4bc7fe903d7ca1a (diff) | |
| parent | 804da384bff556d3caedf9ad01d57f2460aee151 (diff) | |
| download | jasper-client-edca8b7407d7c9b1497ba1722d1b66ffa4b4c234.tar.gz jasper-client-edca8b7407d7c9b1497ba1722d1b66ffa4b4c234.zip | |
Merge pull request #217 from Holzhaus/style-fixes
Style fixes
Diffstat (limited to 'client/g2p.py')
| -rw-r--r-- | client/g2p.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/client/g2p.py b/client/g2p.py index 6e308ef..89f2282 100644 --- a/client/g2p.py +++ b/client/g2p.py @@ -16,11 +16,13 @@ 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) - if 'pocketsphinx' in profile and 'fst_model' in profile['pocketsphinx']: + if ('pocketsphinx' in profile and + 'fst_model' in profile['pocketsphinx']): FST_MODEL = profile['pocketsphinx']['fst_model'] if not FST_MODEL: - FST_MODEL = os.path.join(jasperpath.APP_PATH, os.pardir, 'phonetisaurus', 'g014b2b.fst') + FST_MODEL = os.path.join(jasperpath.APP_PATH, os.pardir, 'phonetisaurus', + 'g014b2b.fst') def parseLine(line): @@ -52,7 +54,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']) + ['phonetisaurus-g2p', '--model=%s' % FST_MODEL, + '--input=%s' % input_filename, '--words', '--isfile']) out = parseOutput(out) if output_filename: @@ -64,8 +67,3 @@ def translateFile(input_filename, output_filename=None): return None return out - -if __name__ == "__main__": - - translateFile(PHONETISAURUS_PATH + "/phonetisaurus/sentences.txt", - PHONETISAURUS_PATH + "/phonetisaurus/dictionary.dic") |
