def run_align_corpus(args, pretrained=None): if pretrained is None: pretrained = get_available_acoustic_languages() try: args.speaker_characters = int(args.speaker_characters) except ValueError: pass args.output_directory = args.output_directory.rstrip('/').rstrip('\\') args.corpus_directory = args.corpus_directory.rstrip('/').rstrip('\\') validate_args(args, pretrained) align_corpus(args)
def run_validate_corpus(args, downloaded_acoustic_models=None, download_dictionaries=None): if downloaded_acoustic_models is None: downloaded_acoustic_models = get_available_acoustic_languages() if download_dictionaries is None: download_dictionaries = get_available_dict_languages() try: args.speaker_characters = int(args.speaker_characters) except ValueError: pass validate_args(args, downloaded_acoustic_models, download_dictionaries) validate_corpus(args)
def run_train_ivector_extractor(args, downloaded_acoustic_models=None, download_dictionaries=None): if downloaded_acoustic_models is None: downloaded_acoustic_models = get_available_acoustic_languages() if download_dictionaries is None: download_dictionaries = get_available_dict_languages() try: args.speaker_characters = int(args.speaker_characters) except ValueError: pass args.corpus_directory = args.corpus_directory.rstrip('/').rstrip('\\') validate_args(args, downloaded_acoustic_models, download_dictionaries) train_ivector(args)
def run_transcribe_corpus(args, pretrained_acoustic=None, pretrained_lm=None): if pretrained_acoustic is None: pretrained_acoustic = get_available_acoustic_languages() if pretrained_lm is None: pretrained_lm = get_available_lm_languages() try: args.speaker_characters = int(args.speaker_characters) except ValueError: pass args.output_directory = args.output_directory.rstrip('/').rstrip('\\') args.corpus_directory = args.corpus_directory.rstrip('/').rstrip('\\') validate_args(args, pretrained_acoustic, pretrained_lm) transcribe_corpus(args)
else: os.environ['PATH'] = thirdparty_dir + ':' + old_path os.environ['LD_LIBRARY_PATH'] = thirdparty_dir + ':' + os.environ.get('LD_LIBRARY_PATH', '') def unfix_path(): if sys.platform == 'win32': sep = ';' os.environ['PATH'] = sep.join(os.environ['PATH'].split(sep)[1:]) else: sep = ':' os.environ['PATH'] = sep.join(os.environ['PATH'].split(sep)[1:]) os.environ['LD_LIBRARY_PATH'] = sep.join(os.environ['PATH'].split(sep)[1:]) acoustic_languages = get_available_acoustic_languages() lm_languages = get_available_lm_languages() g2p_languages = get_available_g2p_languages() dict_languages = get_available_dict_languages() parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(dest="subcommand") subparsers.required = True align_parser = subparsers.add_parser('align') align_parser.add_argument('corpus_directory', help='Full path to the directory to align') align_parser.add_argument('dictionary_path', help='Full path to the pronunciation dictionary to use') align_parser.add_argument('acoustic_model_path', help='Full path to the archive containing pre-trained model or language ({})'.format( ', '.join(acoustic_languages)))