diff options
Diffstat (limited to 'client')
| -rw-r--r-- | client/g2p.py | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/client/g2p.py b/client/g2p.py index b14ee98..a2b3982 100644 --- a/client/g2p.py +++ b/client/g2p.py @@ -1,14 +1,11 @@ # -*- coding: utf-8-*- import os -import sys import re import subprocess import tempfile -import shutil import logging -if sys.version_info < (3, 3): - import distutils.spawn +import diagnose import jasperpath import yaml @@ -18,16 +15,6 @@ class PhonetisaurusG2P(object): r'(?P<pronounciation>.*) </s>', re.MULTILINE) @classmethod - def executable_found(cls): - if sys.version_info < (3, 3): - cmd_exists = distutils.spawn.find_executable - else: - cmd_exists = shutil.which - # Required binary for this class - cmd = 'phonetisaurus-g2p' - return cmd_exists(cmd) - - @classmethod def execute(cls, fst_model, input, is_file=False, nbest=None): logger = logging.getLogger(__name__) @@ -94,7 +81,7 @@ class PhonetisaurusG2P(object): return conf def __new__(cls, fst_model=None, *args, **kwargs): - if not cls.executable_found(): + if not diagnose.check_executable('phonetisaurus-g2p'): raise OSError("Can't find command 'phonetisaurus-g2p'! Please " + "check if Phonetisaurus is installed and in your " + "$PATH.") |
