void ScoreTree:: recordGold(InputTree* tree, ParseStats& parseStats) { if( tree->subTrees().empty() ) { return; } ECString trm = tree->term(); if(trm != "" && trm != "S1") { /* now this simply records how many applicable constits there are */ if(trm == "PRT") trm = "ADVP"; int indx = Term::get(trm)->toInt(); indx = indx*100 + equivInt(tree->start()); indx = indx*500 + equivInt(tree->finish()); //cerr << "ADD " << indx << " " << trm << " " // << equivInt(start_) << " " << equivInt(finish_) << endl; trips.insert(indx); //cerr << "New in g " << *this << endl; parseStats.numInGold++; } InputTree *subTree; InputTreesIter subTreeIter = tree->subTrees().begin(); for( ; subTreeIter != tree->subTrees().end() ; subTreeIter++ ) { subTree = *subTreeIter; recordGold(subTree, parseStats ); } }
int InputTree:: puncEquiv(int i, vector<ECString>& sr) { if(i == 0) return i; if(scorePunctuation(sr[i-1])) return equivInt(i-1); return i; }
int InputTree:: equivInt(int x) { int equivpos = equivPos[x]; //cerr << "EI " << x << " " << equivpos << endl; if(equivpos < 0) return x; else return equivInt(equivpos); }
bool ScoreTree:: lexact2(InputTree* tree) { int strt = equivInt(tree->start()); int fnsh = equivInt(tree->finish()); ECString trm = tree->term(); if(trm == "PRT") trm = "ADVP"; int indx = Term::get(trm)->toInt(); indx = indx*100 + strt; indx = indx*500 + fnsh; //cerr << "LE20 " << indx << " " << trm << " " << start_ << " " << strt << " " << fnsh << endl; multiset<int>::iterator fnd = trips.find(indx); if(fnd == trips.end()) return false; trips.erase(fnd); //cerr << "LE22 " << trips.size() << endl; return true; }