diff options
author | Chris Dyer <redpony@gmail.com> | 2009-12-08 21:38:55 -0500 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2009-12-08 21:38:55 -0500 |
commit | dc6930c00b4b276883280cff1ed6dcd9ddef03c7 (patch) | |
tree | d76d25baf66459d13da4faedffd7d6faba28a513 /src/grammar.cc | |
parent | 5082307f382a6563d4ffb97034137da4e362e629 (diff) |
LICENSE fixes, full support of lattice decoding
Diffstat (limited to 'src/grammar.cc')
-rw-r--r-- | src/grammar.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/grammar.cc b/src/grammar.cc index e0b2a09e..e19bd344 100644 --- a/src/grammar.cc +++ b/src/grammar.cc @@ -15,9 +15,10 @@ RuleBin::~RuleBin() {} GrammarIter::~GrammarIter() {} Grammar::~Grammar() {} -bool Grammar::HasRuleForSpan(int i, int j) const { +bool Grammar::HasRuleForSpan(int i, int j, int distance) const { (void) i; (void) j; + (void) distance; return true; // always true by default } @@ -119,8 +120,8 @@ void TextGrammar::ReadFromFile(const string& filename) { cerr << " " << rule_count << " rules read.\n"; } -bool TextGrammar::HasRuleForSpan(int i, int j) const { - return (max_span_ >= (j - i)); +bool TextGrammar::HasRuleForSpan(int i, int j, int distance) const { + return (max_span_ >= distance); } GlueGrammar::GlueGrammar(const string& file) : TextGrammar(file) {} @@ -136,7 +137,7 @@ GlueGrammar::GlueGrammar(const string& goal_nt, const string& default_nt) { //cerr << "GLUE: " << glue->AsString() << endl; } -bool GlueGrammar::HasRuleForSpan(int i, int j) const { +bool GlueGrammar::HasRuleForSpan(int i, int j, int distance) const { (void) j; return (i == 0); } @@ -156,7 +157,7 @@ PassThroughGrammar::PassThroughGrammar(const Lattice& input, const string& cat) } } -bool PassThroughGrammar::HasRuleForSpan(int i, int j) const { +bool PassThroughGrammar::HasRuleForSpan(int i, int j, int distance) const { const set<int>& hr = has_rule_[i]; if (i == j) { return !hr.empty(); } return (hr.find(j) != hr.end()); |