Make trie parameter optional, building it on demand if not passed

This commit is contained in:
Reuben Morais 2018-10-25 17:01:11 -03:00
parent 3cc9b3711d
commit b29d0abb1e
3 changed files with 3 additions and 3 deletions

View File

@ -200,7 +200,7 @@ main(int argc, char **argv)
return 1; return 1;
} }
if (lm && trie) { if (lm) {
int status = DS_EnableDecoderWithLM(ctx, int status = DS_EnableDecoderWithLM(ctx,
alphabet, alphabet,
lm, lm,

View File

@ -98,7 +98,7 @@ audioStream.on('finish', () => {
const model_load_end = process.hrtime(model_load_start); const model_load_end = process.hrtime(model_load_start);
console.error('Loaded model in %ds.', totalTime(model_load_end)); console.error('Loaded model in %ds.', totalTime(model_load_end));
if (args['lm'] && args['trie']) { if (args['lm']) {
console.error('Loading language model from files %s %s', args['lm'], args['trie']); console.error('Loading language model from files %s %s', args['lm'], args['trie']);
const lm_load_start = process.hrtime(); const lm_load_start = process.hrtime();
model.enableDecoderWithLM(args['alphabet'], args['lm'], args['trie'], model.enableDecoderWithLM(args['alphabet'], args['lm'], args['trie'],

View File

@ -82,7 +82,7 @@ def main():
model_load_end = timer() - model_load_start model_load_end = timer() - model_load_start
print('Loaded model in {:.3}s.'.format(model_load_end), file=sys.stderr) print('Loaded model in {:.3}s.'.format(model_load_end), file=sys.stderr)
if args.lm and args.trie: if args.lm:
print('Loading language model from files {} {}'.format(args.lm, args.trie), file=sys.stderr) print('Loading language model from files {} {}'.format(args.lm, args.trie), file=sys.stderr)
lm_load_start = timer() lm_load_start = timer()
ds.enableDecoderWithLM(args.alphabet, args.lm, args.trie, LM_WEIGHT, ds.enableDecoderWithLM(args.alphabet, args.lm, args.trie, LM_WEIGHT,