diff options
Diffstat (limited to 'src/srilm.py')
-rw-r--r-- | src/srilm.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/srilm.py b/src/srilm.py new file mode 100644 index 0000000..ef371cf --- /dev/null +++ b/src/srilm.py @@ -0,0 +1,20 @@ +import logging +import subprocess + +class SRILM: + + def __init__(self, config): + self.config = config + + def run_ngram_count(self): + log = open('%s/lm.log' % self.config.experiment_dir, 'w') + p = subprocess.Popen([self.config.srilm_ngram_count, + '-text', '%s/train.%s.lm' % (self.config.experiment_dir, self.config.tgt), + '-order', '3', + '-no-sos', + '-no-eos', + '-lm', '%s/%s.arpa' % (self.config.experiment_dir, self.config.tgt), + '-unk'], + stderr=log) + p.wait() + log.close() |