diff options
author | Chris Dyer <cdyer@cab.ark.cs.cmu.edu> | 2012-07-20 01:06:50 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cab.ark.cs.cmu.edu> | 2012-07-20 01:06:50 -0400 |
commit | 5b47c6aa65cd73e208dd941ec75229af5f9c0c67 (patch) | |
tree | 3bd306cb8ca8100b4981c4e5aabf4b16705a1fbe | |
parent | 93333a18dd2dff0b5a9b7e0fc85e21d2f67f239b (diff) |
fix
-rw-r--r-- | decoder/scfg_translator.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/decoder/scfg_translator.cc b/decoder/scfg_translator.cc index aaa6c40b..a978cfc2 100644 --- a/decoder/scfg_translator.cc +++ b/decoder/scfg_translator.cc @@ -299,11 +299,12 @@ Check for grammar pointer in the sentence markup, for use with sentence specific */ void SCFGTranslator::ProcessMarkupHintsImpl(const map<string, string>& kv) { map<string,string>::const_iterator it = kv.find("grammar"); - - TextGrammar* sentGrammar = new TextGrammar(it->second); - sentGrammar->SetMaxSpan(pimpl_->max_span_limit); - sentGrammar->SetGrammarName(it->second); - pimpl_->AddSupplementalGrammar(GrammarPtr(sentGrammar)); + if (it != kv.end()) { + TextGrammar* sentGrammar = new TextGrammar(it->second); + sentGrammar->SetMaxSpan(pimpl_->max_span_limit); + sentGrammar->SetGrammarName(it->second); + pimpl_->AddSupplementalGrammar(GrammarPtr(sentGrammar)); + } } void SCFGTranslator::AddSupplementalGrammarFromString(const std::string& grammar) { |