diff options
author | Patrick Simianer <p@simianer.de> | 2011-07-27 00:03:35 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2011-09-23 19:13:57 +0200 |
commit | 05c41075d0018ca6142f7ba593742fbadfecdf65 (patch) | |
tree | dbcc5d241eb92691b26ea12d5a07646a6a0201c6 /decoder/scfg_translator.cc | |
parent | 1ee85918c6aaaf0ca9d72f7b876ba18e0c531b3e (diff) |
hacking in weights setting, getting
Diffstat (limited to 'decoder/scfg_translator.cc')
-rw-r--r-- | decoder/scfg_translator.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/decoder/scfg_translator.cc b/decoder/scfg_translator.cc index 9ca11cd9..9fdddfdb 100644 --- a/decoder/scfg_translator.cc +++ b/decoder/scfg_translator.cc @@ -107,14 +107,17 @@ struct SCFGTranslatorImpl { bool operator()(const GrammarPtr& x) const { return x->GetGrammarName() == name_; } const string name_; }; void SetSentenceGrammar(const std::string& grammar_string) { + assert( grammar_string != "" ); if (!SILENT) cerr << "Setting sentence grammar" << endl; usingSentenceGrammar = true; - istringstream in(grammar_string); - TextGrammar* sent_grammar = new TextGrammar(&in); - sent_grammar->SetMaxSpan(max_span_limit); - sent_grammar->SetGrammarName("__psg"); - grammars.erase (remove_if(grammars.begin(), grammars.end(), NameEquals("__psg")), grammars.end()); - grammars.push_back(GrammarPtr(sent_grammar)); + //FD::Freeze(); + istringstream in( grammar_string ); + TextGrammar* sent_grammar = new TextGrammar( &in ); + sent_grammar->SetMaxSpan( max_span_limit ); + sent_grammar->SetGrammarName( "__psg" ); + grammars.erase ( remove_if(grammars.begin(), grammars.end(), NameEquals("__psg")), grammars.end() ); + grammars.push_back( GrammarPtr(sent_grammar) ); + //FD::UnFreeze(); } bool Translate(const string& input, |