summaryrefslogtreecommitdiff
path: root/decoder/scfg_translator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'decoder/scfg_translator.cc')
-rw-r--r--decoder/scfg_translator.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/decoder/scfg_translator.cc b/decoder/scfg_translator.cc
index 9fdddfdb..646d67fa 100644
--- a/decoder/scfg_translator.cc
+++ b/decoder/scfg_translator.cc
@@ -106,18 +106,16 @@ struct SCFGTranslatorImpl {
struct NameEquals { NameEquals(const string name) : name_(name) {}
bool operator()(const GrammarPtr& x) const { return x->GetGrammarName() == name_; } const string name_; };
- void SetSentenceGrammar(const std::string& grammar_string) {
- assert( grammar_string != "" );
+ void SetSentenceGrammarFromString(const std::string& grammar_str) {
+ assert( grammar_str != "" );
if (!SILENT) cerr << "Setting sentence grammar" << endl;
usingSentenceGrammar = true;
- //FD::Freeze();
- istringstream in( grammar_string );
+ istringstream in( grammar_str );
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,
@@ -321,8 +319,8 @@ void SCFGTranslator::SetSupplementalGrammar(const std::string& grammar) {
pimpl_->SetSupplementalGrammar(grammar);
}
-void SCFGTranslator::SetSentenceGrammar(const std::string& grammar) {
- pimpl_->SetSentenceGrammar(grammar);
+void SCFGTranslator::SetSentenceGrammarFromString(const std::string& grammar_str) {
+ pimpl_->SetSentenceGrammarFromString(grammar_str);
}
void SCFGTranslator::SentenceCompleteImpl() {