How to use the nltools.misc.load_config function in nltools

To help you get started, we’ve selected a few nltools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gooofy / zamia-speech / speech_lex_conv_cmudict.py View on Github external
(options, args) = parser.parse_args()

if options.verbose:
    logging.basicConfig(level=logging.DEBUG)
else:
    logging.basicConfig(level=logging.INFO)

if len(args) != 1:
    parser.print_usage()
    sys.exit(1)

#
# load config, set up global variables
#

config = misc.load_config ('.speechrc')

#
# convert CMU dict to zamia-speech IPA format
#

lex_new = {}

with codecs.open(args[0], 'r', 'utf8') as dictf:

    for line in dictf:

        if '#' in line:
            logging.debug('comment        : %s' % line)
            line = line.split('#')[0]
            logging.debug('comment removed: %s' % line)
github gooofy / zamia-speech / import_mailabs.py View on Github external
parser.add_option ("-v", "--verbose", action="store_true", dest="verbose",
                   help="verbose output")

(options, args) = parser.parse_args()

if options.verbose:
    logging.basicConfig(level=logging.DEBUG)
else:
    logging.basicConfig(level=logging.INFO)

#
# config
#

config = misc.load_config('.speechrc')

speech_arc     = config.get("speech", "speech_arc")
speech_corpora = config.get("speech", "speech_corpora")

srcdir  = '%s/m_ailabs' % speech_arc

#
# audio, prompts
#

all_utts = set()

cnt = 0
with open('tmp/run_parallel.sh', 'w') as scriptf:

    for localedir in os.listdir(srcdir):
github gooofy / zamia-speech / speech_sphinx_export.py View on Github external
WORKDIR_CONT = 'data/dst/asr-models/cmusphinx_cont/%s'
WORKDIR_PTM  = 'data/dst/asr-models/cmusphinx_ptm/%s'

NJOBS = 12

ENABLE_NOISE_FILLER = False # CMU Sphinx decoding seems to become unstable otherwise
NOISE_WORD = 'nspc'

#
# init 
#

misc.init_app ('speech_sphinx_export')

config = misc.load_config ('.speechrc')

#
# commandline parsing
#

parser = OptionParser("usage: %prog [options] model_name dict lm corpus [corpus2 ...]")

parser.add_option ("-d", "--debug", dest="debug", type='int', default=0,
                   help="limit number of transcripts (debug purposes only), default: 0 (unlimited)")
parser.add_option ("-v", "--verbose", action="store_true", dest="verbose",
                   help="enable verbose logging")

(options, args) = parser.parse_args()

if options.verbose:
    logging.basicConfig(level=logging.DEBUG)
github gooofy / zamia-speech / speech_stats.py View on Github external
# corpus_name = 'tedlium3'
# corpus_name = 'm_ailabs_en'
# corpus_name = 'voxforge_en'

if options.verbose:
    logging.basicConfig(level=logging.DEBUG)
    logging.getLogger("requests").setLevel(logging.WARNING)
else:
    logging.basicConfig(level=logging.INFO)

#
# config
#

config = misc.load_config('.speechrc')

wav16_dir   = config.get("speech", "wav16")

#
# load transcripts
#

logging.info("loading transcripts...")
transcripts = Transcripts(corpus_name=corpus_name)
logging.info("loading transcripts...done.")

#
# compute stats
#

def format_duration(duration):
github gooofy / zamia-speech / import_librispeech.py View on Github external
parser.add_option ("-v", "--verbose", action="store_true", dest="verbose",
                   help="verbose output")

(options, args) = parser.parse_args()

if options.verbose:
    logging.basicConfig(level=logging.DEBUG)
else:
    logging.basicConfig(level=logging.INFO)

#
# config
#

config = misc.load_config('.speechrc')

speech_arc     = config.get("speech", "speech_arc")
speech_corpora = config.get("speech", "speech_corpora")

srcdir  = '%s/LibriSpeech' % speech_arc
destdir = '%s/librispeech' % speech_corpora

misc.mkdirs(destdir)

#
# speakers
#

with open ('spk2gender.txt', 'w') as genderf:
    with open ('%s/SPEAKERS.TXT' % srcdir, 'r') as speakersf:
github gooofy / zamia-speech / import_ljspeech.py View on Github external
parser.add_option ("-v", "--verbose", action="store_true", dest="verbose",
                   help="verbose output")

(options, args) = parser.parse_args()

if options.verbose:
    logging.basicConfig(level=logging.DEBUG)
else:
    logging.basicConfig(level=logging.INFO)

#
# config
#

config = misc.load_config('.speechrc')

speech_arc     = config.get("speech", "speech_arc")
speech_corpora = config.get("speech", "speech_corpora")

srcdir  = '%s/LJSpeech-1.1' % speech_arc
destdir = '%s/ljspeech' % speech_corpora

#
# audio, prompts
#

all_utts = set()

cnt = 0
with open('tmp/run_parallel.sh', 'w') as scriptf:
github gooofy / zamia-ai / ai_trainer.py View on Github external
parser.add_option("-v", "--verbose", action="store_true", dest="verbose", 
                  help="enable debug output")

(options, args) = parser.parse_args()

if options.verbose:
    logging.basicConfig(level=logging.DEBUG)
    logging.getLogger("requests").setLevel(logging.WARNING)
else:
    logging.basicConfig(level=logging.INFO)

#
# config
#

config = misc.load_config('.airc')

ai_model            = config.get   ('server', 'model')
lang                = config.get   ('server', 'lang')
vf_login            = config.get   ('server', 'vf_login')
rec_dir             = config.get   ('server', 'rec_dir')
kaldi_model_dir     = config.get   ('server', 'kaldi_model_dir')
kaldi_model         = config.get   ('server', 'kaldi_model')

loc                 = config.get   ('vad',    'loc')
source              = config.get   ('vad',    'source')
volume              = config.getint('vad',    'volume')
aggressiveness      = config.getint('vad',    'aggressiveness')

#
# curses
#
github gooofy / zamia-speech / auto_review.py View on Github external
from kaldiasr.nnet3     import KaldiNNet3OnlineModel, KaldiNNet3OnlineDecoder

DEFAULT_ASR_MODEL = 'kaldi-chain-voxforge-de-latest'

MODELDIR    = 'data/models/%s'
SAVE_RATE   = 10
FAILLOG     = 'tmp/decoding_fails.txt'

#
# init 
#

misc.init_app ('auto_review')

config = misc.load_config ('.speechrc')

#
# command line
#

parser = OptionParser("usage: %prog [options] corpus")

parser.add_option ("-a", "--all", action="store_true", dest="do_all", 
                   help="do not use ASR but auto-rate all matching submissions")

parser.add_option ("-f", "--filter", dest="ts_filter", type = "str", 
                   help="filter (default: no filtering)")

parser.add_option ("-l", "--lang", dest="lang", type = "str", default="de",
                   help="tokenizer language (default: de)")
github gooofy / zamia-ai / ai_cli.py View on Github external
def __init__(self):
       
        cmdln.Cmdln.__init__(self)

        self.config = misc.load_config('.airc')
        toplevel    = self.config.get('semantics', 'toplevel')
        xsb_root    = self.config.get('semantics', 'xsb_root')
        db_url      = self.config.get('db', 'url')

        self.kernal = AIKernal(db_url, xsb_root, toplevel)