コード例 #1
0
int
tree_ruleHead_third(FullHist* treeh)
{
  Val* specTree = NULL;
  if(Feature::isLM) specTree = tree_ruleTree(treeh, 2);
  if(specTree)
    {
      FullHist* pt = treeh->back;
      if(!pt) return nullWordInt;
      int ans = pt->hd->toInt();
      return ans;
    }
  Val* trdtree = tree_ruleTree(treeh,3);
  if(!trdtree) return nullWordInt;
  else return trdtree->wrd();
}
コード例 #2
0
int
fh_parent_head(FullHist* tree)
{
  Val* spectree = NULL;
  if(Feature::isLM) spectree = tree_ruleTree(tree, 2);
  if(spectree)
    {
      //cerr << "found  st " << endl;
      return spectree->wrd();
    }
  FullHist* pt = tree->back;
  if(!pt) return nullWordInt;
  int ans = pt->hd->toInt();
  assert(ans >= -1);
  return ans;
}