summaryrefslogtreecommitdiff
path: root/src/srilm.py
diff options
context:
space:
mode:
authorJacob <andqso@gmail.com>2013-07-28 09:54:54 +0100
committerJacob <andqso@gmail.com>2013-07-28 09:54:54 +0100
commitf343459d6198352964dbb6779f15c352fe2d5794 (patch)
tree07d50c9a8269e3892ccea8f5680b3e2bac984fce /src/srilm.py
init
Diffstat (limited to 'src/srilm.py')
-rw-r--r--src/srilm.py20
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()