diff options
author | linh.kitty <linh.kitty@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-16 20:34:09 +0000 |
---|---|---|
committer | linh.kitty <linh.kitty@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-16 20:34:09 +0000 |
commit | 8099ca52236e1512e7f201b5c5defd1e51bb1c29 (patch) | |
tree | ac7fd4c25f367908f9acb5b94a9c542d75cd8ac9 /gi/scfg | |
parent | fe976cf98c3306bda017d6ddd2f519922d5354d7 (diff) |
add
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@291 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/scfg')
-rwxr-xr-x | gi/scfg/abc/Release/scfg | bin | 4437132 -> 4438644 bytes | |||
-rw-r--r-- | gi/scfg/abc/agrammar.h | 2 | ||||
-rw-r--r-- | gi/scfg/abc/scfg.cpp | 6 |
3 files changed, 7 insertions, 1 deletions
diff --git a/gi/scfg/abc/Release/scfg b/gi/scfg/abc/Release/scfg Binary files differindex 41b6b583..3faa52cc 100755 --- a/gi/scfg/abc/Release/scfg +++ b/gi/scfg/abc/Release/scfg diff --git a/gi/scfg/abc/agrammar.h b/gi/scfg/abc/agrammar.h index 0a8a60ac..0910aae6 100644 --- a/gi/scfg/abc/agrammar.h +++ b/gi/scfg/abc/agrammar.h @@ -9,7 +9,7 @@ using namespace std; class aTRule: public TRule{ public: - aTRuleTRule : TRule(){ResetScore(0.00000001); } + aTRule() : TRule(){ResetScore(0.00000001); } aTRule(TRulePtr rule_); void ResetScore(double initscore){//cerr<<"Reset Score "<<this->AsString()<<endl; diff --git a/gi/scfg/abc/scfg.cpp b/gi/scfg/abc/scfg.cpp index b3dbad34..1e59fb4a 100644 --- a/gi/scfg/abc/scfg.cpp +++ b/gi/scfg/abc/scfg.cpp @@ -145,6 +145,7 @@ int main(int argc, char** argv){ } cerr<<"get parametters\n\n\n"; + string grammar_file = params.asString("grammar_file", "./grammar.pr"); string input_file = params.asString("input_file", "parallel_corpora"); @@ -186,6 +187,7 @@ int main(int argc, char** argv){ Hypergraph hg; int data_size = src_corpus.size(); + int cnt_unparsed =0; for (int i =0; i <split_iters; i++){ cerr<<"Split Nonterminals, iteration "<<(i+1)<<endl; @@ -208,13 +210,17 @@ int main(int argc, char** argv){ if (! parseSentencePair(goal_sym, src, tgt, g, hg) ){ cerr<<"target sentence is not parsed by the grammar!\n"; //return 1; + cnt_unparsed++; continue; } + cerr<<"update edge posterior prob"<<endl; boost::static_pointer_cast<aGrammar>(g)->UpdateHgProsteriorProb(hg); hg.clear(); + if (k%1000 ==0 ) cerr<<"sentences "<<k<<endl; } + cerr<<"cnt_unparased="<<cnt_unparsed<<endl; boost::static_pointer_cast<aGrammar>(g)->UpdateScore(); } boost::static_pointer_cast<aGrammar>(g)->PrintAllRules(output_file+".e" + itos(i+1)); |