From f343459d6198352964dbb6779f15c352fe2d5794 Mon Sep 17 00:00:00 2001 From: Jacob Date: Sun, 28 Jul 2013 09:54:54 +0100 Subject: init --- src/srilm.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/srilm.py (limited to 'src/srilm.py') 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() -- cgit v1.2.3