int tree_grandparent_pos(TreeHist* treeh) { static int stopint = 0; if(!stopint) { ECString stopnm("STOP"); stopint = Term::get(stopnm)->toInt(); } InputTree* tree = treeh->tree; InputTree* par1 = tree->parent(); if(!par1) return stopint; InputTree* par = par1->parent(); if(!par) return stopint; const ECString& trmStr = par->hTag(); const Term* trm = Term::get(trmStr); assert(trm); if(!trm->terminal_p()) { cerr << "Bad head Part of Speech: " << *trm << " in " <<endl; cerr << *tree << endl; assert(trm->terminal_p()); } return trm->toInt(); }
int tree_pos(TreeHist* treeh) { InputTree* tree = treeh->tree; const ECString& trmStr = tree->hTag(); const Term* trm = Term::get(trmStr); assert(trm); if(!trm->terminal_p()) { cerr << "Bad head Part of Speech: " << *trm << " in " <<endl; cerr << *tree << endl; assert(trm->terminal_p()); } return trm->toInt(); }