diff options
author | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-09-06 17:46:41 +0100 |
---|---|---|
committer | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-09-06 17:46:41 +0100 |
commit | 1cef9b6842fec7598a0a0571f69bf4caab8e4c91 (patch) | |
tree | 89c3b5cf241c3a49688994ce19a07c7cdd01aa71 /python/src/sa/rulefactory.pxi | |
parent | c1b77250f656c4cff9f0e532d6b6644cb0dc993c (diff) |
[cdec.sa] Allow sentence annotation and initial configuration
Diffstat (limited to 'python/src/sa/rulefactory.pxi')
-rw-r--r-- | python/src/sa/rulefactory.pxi | 9 |
1 files changed, 5 insertions, 4 deletions
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: |