summaryrefslogtreecommitdiff
path: root/decoder/scfg_translator.cc
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cab.ark.cs.cmu.edu>2012-07-20 01:06:50 -0400
committerChris Dyer <cdyer@cab.ark.cs.cmu.edu>2012-07-20 01:06:50 -0400
commitc4c9c2febd5af552ecddc215758e32b88013fbc7 (patch)
tree6c4c99df89abb3250cae54db13162f741acaf584 /decoder/scfg_translator.cc
parent09d085e16f31b36b1177b313ee54414eb29d9082 (diff)
fix
Diffstat (limited to 'decoder/scfg_translator.cc')
-rw-r--r--decoder/scfg_translator.cc11
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) {