From 1cef9b6842fec7598a0a0571f69bf4caab8e4c91 Mon Sep 17 00:00:00 2001 From: Victor Chahuneau Date: Thu, 6 Sep 2012 17:46:41 +0100 Subject: [cdec.sa] Allow sentence annotation and initial configuration --- python/src/sa/rulefactory.pxi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'python/src/sa/rulefactory.pxi') diff --git a/python/src/sa/rulefactory.pxi b/python/src/sa/rulefactory.pxi index 3973554c..248105d3 100644 --- a/python/src/sa/rulefactory.pxi +++ b/python/src/sa/rulefactory.pxi @@ -21,7 +21,8 @@ FeatureContext = namedtuple('FeatureContext', 'matches', 'test_sentence', 'f_text', - 'e_text' + 'e_text', + 'meta' ]) cdef int PRECOMPUTE = 0 @@ -934,7 +935,7 @@ cdef class HieroCachingRuleFactory: candidate.append([next_id,curr[1]+jump]) return sorted(result); - def input(self, fwords): + def input(self, fwords, meta): '''When this function is called on the RuleFactory, it looks up all of the rules that can be used to translate the input sentence''' @@ -1105,8 +1106,8 @@ cdef class HieroCachingRuleFactory: count = len(locs) scores = self.scorer.score(FeatureContext( f, e, count, fcount[f], num_samples, - (k,i+spanlen), locs, fwords, self.fda, self.eda - )) + (k,i+spanlen), locs, fwords, self.fda, self.eda, + meta)) yield Rule(self.category, f, e, scores, alignment) if len(phrase) < self.max_length and i+spanlen < len(fwords) and pathlen+1 <= self.max_initial_size: -- cgit v1.2.3