summaryrefslogtreecommitdiff
path: root/decoder/decoder.cc
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-07-20 00:46:10 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-07-20 00:46:10 -0400
commit93333a18dd2dff0b5a9b7e0fc85e21d2f67f239b (patch)
treebc7aa803c076a958d45a7839627b424a54832a63 /decoder/decoder.cc
parentdfebe92df6e09b8950c93e08fadccd95763186f8 (diff)
enable programmatic setting of grammar objects, cleanup of grammar handling
Diffstat (limited to 'decoder/decoder.cc')
-rw-r--r--decoder/decoder.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/decoder/decoder.cc b/decoder/decoder.cc
index 333f0fb6..ad4e9e07 100644
--- a/decoder/decoder.cc
+++ b/decoder/decoder.cc
@@ -743,16 +743,14 @@ bool Decoder::Decode(const string& input, DecoderObserver* o) {
}
vector<weight_t>& Decoder::CurrentWeightVector() { return pimpl_->CurrentWeightVector(); }
const vector<weight_t>& Decoder::CurrentWeightVector() const { return pimpl_->CurrentWeightVector(); }
-void Decoder::SetSupplementalGrammar(const std::string& grammar_string) {
- assert(pimpl_->translator->GetDecoderType() == "SCFG");
- static_cast<SCFGTranslator&>(*pimpl_->translator).SetSupplementalGrammar(grammar_string);
+void Decoder::AddSupplementalGrammar(GrammarPtr gp) {
+ static_cast<SCFGTranslator&>(*pimpl_->translator).AddSupplementalGrammar(gp);
}
-void Decoder::SetSentenceGrammarFromString(const std::string& grammar_str) {
+void Decoder::AddSupplementalGrammarFromString(const std::string& grammar_string) {
assert(pimpl_->translator->GetDecoderType() == "SCFG");
- static_cast<SCFGTranslator&>(*pimpl_->translator).SetSentenceGrammarFromString(grammar_str);
+ static_cast<SCFGTranslator&>(*pimpl_->translator).AddSupplementalGrammarFromString(grammar_string);
}
-
bool DecoderImpl::Decode(const string& input, DecoderObserver* o) {
string buf = input;
NgramCache::Clear(); // clear ngram cache for remote LM (if used)