diff options
author | Chris Dyer <redpony@gmail.com> | 2014-09-17 12:39:47 -0400 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2014-09-17 12:39:47 -0400 |
commit | c20decbd6b9be8f1a7d567cd72300b4e9582b55c (patch) | |
tree | 79c844304f2aa3f42b44236ba755200f4f87b7f6 /python/cdec/_cdec.pyx | |
parent | 3822a2063e36b6ced948e5c22910a373c6c691b2 (diff) | |
parent | a861980460220a31592bdb2e951a55faeebb8c6d (diff) |
Merge pull request #51 from wilkeraziz/master
a few minor changes to pycdec
Diffstat (limited to 'python/cdec/_cdec.pyx')
-rw-r--r-- | python/cdec/_cdec.pyx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/python/cdec/_cdec.pyx b/python/cdec/_cdec.pyx index 2e4265d4..2509c6cd 100644 --- a/python/cdec/_cdec.pyx +++ b/python/cdec/_cdec.pyx @@ -85,13 +85,13 @@ cdef class Decoder: cdef variables_map* conf = &self.dec.GetConf() return str(conf[0]['formalism'].as_str().c_str()) - def read_weights(self, weights): + def read_weights(self, weights, scaling = 1.0): """decoder.read_weights(filename): Read decoder weights from a file.""" with open(weights) as fp: for line in fp: if line.strip().startswith('#'): continue fname, value = line.split() - self.weights[fname.strip()] = float(value) + self.weights[fname.strip()] = float(value) * scaling def translate(self, sentence, grammar=None): """decoder.translate(sentence, grammar=None) -> Hypergraph |