コード例 #1
0
ファイル: ivona.py プロジェクト: ollmer/jane
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # HMM dir
     # Try to get hmm_dir from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'ivona-tts' in profile:
                 if 'access_key' in profile['ivona-tts']:
                     config['access_key'] = \
                         profile['ivona-tts']['access_key']
                 if 'secret_key' in profile['ivona-tts']:
                     config['secret_key'] = \
                         profile['ivona-tts']['secret_key']
                 if 'region' in profile['ivona-tts']:
                     config['region'] = profile['ivona-tts']['region']
                 if 'voice' in profile['ivona-tts']:
                     config['voice'] = profile['ivona-tts']['voice']
                 if 'speech_rate' in profile['ivona-tts']:
                     config['speech_rate'] = \
                         profile['ivona-tts']['speech_rate']
                 if 'sentence_break' in profile['ivona-tts']:
                     config['sentence_break'] = \
                         profile['ivona-tts']['sentence_break']
     return config
コード例 #2
0
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # HMM dir
     # Try to get hmm_dir from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'ivona-tts' in profile:
                 if 'access_key' in profile['ivona-tts']:
                     config['access_key'] = \
                         profile['ivona-tts']['access_key']
                 if 'secret_key' in profile['ivona-tts']:
                     config['secret_key'] = \
                         profile['ivona-tts']['secret_key']
                 if 'region' in profile['ivona-tts']:
                     config['region'] = profile['ivona-tts']['region']
                 if 'voice' in profile['ivona-tts']:
                     config['voice'] = profile['ivona-tts']['voice']
                 if 'speech_rate' in profile['ivona-tts']:
                     config['speech_rate'] = \
                         profile['ivona-tts']['speech_rate']
                 if 'sentence_break' in profile['ivona-tts']:
                     config['sentence_break'] = \
                         profile['ivona-tts']['sentence_break']
     return config
コード例 #3
0
ファイル: __init__.py プロジェクト: ollmer/jane
 def get_instance(cls, vocabulary_name, phrases):
     config = cls.get_config()
     if cls.VOCABULARY_TYPE:
         vocabulary = cls.VOCABULARY_TYPE(vocabulary_name,
                                          path=paths.config('vocabularies'))
         if not vocabulary.matches_phrases(phrases):
             vocabulary.compile(phrases)
         config['vocabulary'] = vocabulary
     instance = cls(**config)
     return instance
コード例 #4
0
ファイル: __init__.py プロジェクト: ollmer/jane
 def get_instance(cls, vocabulary_name, phrases):
     config = cls.get_config()
     if cls.VOCABULARY_TYPE:
         vocabulary = cls.VOCABULARY_TYPE(vocabulary_name,
                                          path=paths.config(
                                              'vocabularies'))
         if not vocabulary.matches_phrases(phrases):
             vocabulary.compile(phrases)
         config['vocabulary'] = vocabulary
     instance = cls(**config)
     return instance
コード例 #5
0
ファイル: __init__.py プロジェクト: ollmer/jane
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # HMM dir
     # Try to get hmm_dir from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'keys' in profile and 'GOOGLE_SPEECH' in profile['keys']:
                 config['api_key'] = profile['keys']['GOOGLE_SPEECH']
     return config
コード例 #6
0
ファイル: __init__.py プロジェクト: ollmer/jane
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # HMM dir
     # Try to get hmm_dir from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'keys' in profile and 'GOOGLE_SPEECH' in profile['keys']:
                 config['api_key'] = profile['keys']['GOOGLE_SPEECH']
     return config
コード例 #7
0
ファイル: __init__.py プロジェクト: ollmer/jane
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # Try to get wit.ai Auth token from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'witai-stt' in profile:
                 if 'access_token' in profile['witai-stt']:
                     config['access_token'] = \
                         profile['witai-stt']['access_token']
     return config
コード例 #8
0
ファイル: flite.py プロジェクト: ollmer/jane
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # HMM dir
     # Try to get hmm_dir from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'flite-tts' in profile:
                 if 'voice' in profile['flite-tts']:
                     config['voice'] = profile['flite-tts']['voice']
     return config
コード例 #9
0
ファイル: flite.py プロジェクト: ollmer/jane
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # HMM dir
     # Try to get hmm_dir from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'flite-tts' in profile:
                 if 'voice' in profile['flite-tts']:
                     config['voice'] = profile['flite-tts']['voice']
     return config
コード例 #10
0
ファイル: __init__.py プロジェクト: ollmer/jane
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # Try to get wit.ai Auth token from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'witai-stt' in profile:
                 if 'access_token' in profile['witai-stt']:
                     config['access_token'] = \
                         profile['witai-stt']['access_token']
     return config
コード例 #11
0
ファイル: __init__.py プロジェクト: ollmer/jane
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # Try to get AT&T app_key/app_secret from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'att-stt' in profile:
                 if 'app_key' in profile['att-stt']:
                     config['app_key'] = profile['att-stt']['app_key']
                 if 'app_secret' in profile['att-stt']:
                     config['app_secret'] = profile['att-stt']['app_secret']
     return config
コード例 #12
0
ファイル: __init__.py プロジェクト: ollmer/jane
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # Try to get AT&T app_key/app_secret from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'att-stt' in profile:
                 if 'app_key' in profile['att-stt']:
                     config['app_key'] = profile['att-stt']['app_key']
                 if 'app_secret' in profile['att-stt']:
                     config['app_secret'] = profile['att-stt']['app_secret']
     return config
コード例 #13
0
ファイル: __init__.py プロジェクト: ollmer/jane
    def get_config(cls):
        # FIXME: Replace this as soon as we have a config module
        config = {}
        # HMM dir
        # Try to get hmm_dir from config
        profile_path = paths.config('profile.yml')

        if os.path.exists(profile_path):
            with open(profile_path, 'r') as f:
                profile = yaml.safe_load(f)
                try:
                    config['hmm_dir'] = profile['pocketsphinx']['hmm_dir']
                except KeyError:
                    pass

        return config
コード例 #14
0
ファイル: __init__.py プロジェクト: ollmer/jane
    def get_config(cls):
        # FIXME: Replace this as soon as we have a config module
        config = {}
        # HMM dir
        # Try to get hmm_dir from config
        profile_path = paths.config('profile.yml')

        if os.path.exists(profile_path):
            with open(profile_path, 'r') as f:
                profile = yaml.safe_load(f)
                try:
                    config['hmm_dir'] = profile['pocketsphinx']['hmm_dir']
                except KeyError:
                    pass

        return config
コード例 #15
0
ファイル: espeak.py プロジェクト: ollmer/jane
 def get_config(cls):
     # FIXME: Replace this as soon as we have a config module
     config = {}
     # HMM dir
     # Try to get hmm_dir from config
     profile_path = paths.config('profile.yml')
     if os.path.exists(profile_path):
         with open(profile_path, 'r') as f:
             profile = yaml.safe_load(f)
             if 'espeak-tts' in profile:
                 if 'voice' in profile['espeak-tts']:
                     config['voice'] = profile['espeak-tts']['voice']
                 if 'pitch_adjustment' in profile['espeak-tts']:
                     config['pitch_adjustment'] = \
                         profile['espeak-tts']['pitch_adjustment']
                 if 'words_per_minute' in profile['espeak-tts']:
                     config['words_per_minute'] = \
                         profile['espeak-tts']['words_per_minute']
     return config
コード例 #16
0
ファイル: app.py プロジェクト: ollmer/jane
    parser = argparse.ArgumentParser(description='Jana Intelligent Voice Assistant')
    parser.add_argument('-t', '--text', action='store_true',
                        help='Use text input instead of a real microphone')
    parser.add_argument('--no-network-check', action='store_true',
                        help='Disable the network connection check')
    parser.add_argument('--diagnose', action='store_true',
                        help='Run diagnose and exit')
    parser.add_argument('-d', '--debug', action='store_true', help='Show debug messages')
    args = parser.parse_args()

    logging.basicConfig()
    logger = logging.getLogger()
    logger.getChild("client.stt").setLevel(logging.INFO)

    options = {
        'config': paths.config('profile.yml')
    }
    if args.text:
        options['text'] = True

    if args.debug:
        logger.setLevel(logging.DEBUG)

    if not args.no_network_check and not diagnose.check_network_connection():
        logger.warning("Network not connected. This may prevent Jasper from " +
                       "running properly.")

    if args.diagnose:
        failed_checks = diagnose.run()
        sys.exit(0 if not failed_checks else 1)
コード例 #17
0
ファイル: app.py プロジェクト: ollmer/jane
                        action='store_true',
                        help='Disable the network connection check')
    parser.add_argument('--diagnose',
                        action='store_true',
                        help='Run diagnose and exit')
    parser.add_argument('-d',
                        '--debug',
                        action='store_true',
                        help='Show debug messages')
    args = parser.parse_args()

    logging.basicConfig()
    logger = logging.getLogger()
    logger.getChild("client.stt").setLevel(logging.INFO)

    options = {'config': paths.config('profile.yml')}
    if args.text:
        options['text'] = True

    if args.debug:
        logger.setLevel(logging.DEBUG)

    if not args.no_network_check and not diagnose.check_network_connection():
        logger.warning("Network not connected. This may prevent Jasper from " +
                       "running properly.")

    if args.diagnose:
        failed_checks = diagnose.run()
        sys.exit(0 if not failed_checks else 1)

    try: