diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-23 19:33:51 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-23 19:33:51 +0200 |
| commit | 5b62b6799e0e193debeb33b47c99999697ec7149 (patch) | |
| tree | 955d4a46119d26395628f6c3c410ff4b19bb7dac /jasper.py | |
| parent | 3a19c26d6d63daf61a7c473bc9ff29d870feeaa2 (diff) | |
| parent | eb8ebf8c834beec1198999cf21b9223482db4c43 (diff) | |
| download | jasper-client-5b62b6799e0e193debeb33b47c99999697ec7149.tar.gz jasper-client-5b62b6799e0e193debeb33b47c99999697ec7149.zip | |
Merge pull request #187 from Holzhaus/jasperpath-usage
Use jasperpath for static resources
Diffstat (limited to 'jasper.py')
| -rwxr-xr-x | jasper.py | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -10,12 +10,8 @@ logger = logging.getLogger(__name__) import yaml import argparse -# Set $JASPER_HOME -if not os.getenv('JASPER_HOME'): - os.environ["JASPER_HOME"] = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) - from client.diagnose import Diagnostics -from client import vocabcompiler, stt +from client import vocabcompiler, stt, jasperpath from client import speaker as speak from client.conversation import Conversation @@ -33,16 +29,15 @@ if args.local: else: from client.mic import Mic -# Change CWD to $JASPER_HOME/jasper/client -client_path = os.path.join(os.getenv("JASPER_HOME"), "jasper", "client") -os.chdir(client_path) -# Add $JASPER_HOME/jasper/client to sys.path -sys.path.append(client_path) +# Change CWD to jasperpath.LIB_PATH +os.chdir(jasperpath.LIB_PATH) +# Add jasperpath.LIB_PATH to sys.path +sys.path.append(jasperpath.LIB_PATH) class Jasper(object): def __init__(self): # Read config - config_file = os.path.abspath(os.path.join(client_path, 'profile.yml')) + config_file = os.path.abspath(os.path.join(jasperpath.LIB_PATH, 'profile.yml')) logger.debug("Trying to read config file: '%s'", config_file) with open(config_file, "r") as f: self.config = yaml.safe_load(f) @@ -59,7 +54,7 @@ class Jasper(object): logger.warning("stt_engine not specified in profile, defaulting to '%s'", stt_engine_type) # Compile dictionary - sentences, dictionary, languagemodel = [os.path.abspath(os.path.join(client_path, filename)) for filename in ("sentences.txt", "dictionary.dic", "languagemodel.lm")] + sentences, dictionary, languagemodel = [os.path.abspath(os.path.join(jasperpath.LIB_PATH, filename)) for filename in ("sentences.txt", "dictionary.dic", "languagemodel.lm")] vocabcompiler.compile(sentences, dictionary, languagemodel) # Initialize Mic |
