From 4a1d2e56744cc97c11ef8220623bd7c5467d6c02 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Wed, 27 Jul 2011 00:03:35 +0200
Subject: hacking in weights setting, getting
---
decoder/hg.h | 2 ++
decoder/scfg_translator.cc | 15 +++++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
(limited to 'decoder')
diff --git a/decoder/hg.h b/decoder/hg.h
index e5ef05f8..70bc4995 100644
--- a/decoder/hg.h
+++ b/decoder/hg.h
@@ -399,6 +399,8 @@ public:
template
void Reweight(const V& weights) {
for (int i = 0; i < edges_.size(); ++i) {
+ SparseVector v;
+ //v.set_value(FD::Convert("use_shell"), 1000);
Edge& e = edges_[i];
e.edge_prob_.logeq(e.feature_values_.dot(weights));
}
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,
--
cgit v1.2.3