summaryrefslogtreecommitdiff
path: root/gi
diff options
context:
space:
mode:
Diffstat (limited to 'gi')
-rwxr-xr-xgi/scfg/abc/Release/scfgbin4437132 -> 4438644 bytes
-rw-r--r--gi/scfg/abc/agrammar.h2
-rw-r--r--gi/scfg/abc/scfg.cpp6
3 files changed, 7 insertions, 1 deletions
diff --git a/gi/scfg/abc/Release/scfg b/gi/scfg/abc/Release/scfg
index 41b6b583..3faa52cc 100755
--- a/gi/scfg/abc/Release/scfg
+++ b/gi/scfg/abc/Release/scfg
Binary files differ
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));