Exemplo n.º 1
0
void
Bchart::
setPosStarts()
{
  int i,j,k,l;
  for(i = 0 ; i < MAXNUMNTTS ; i++)
    for(j = 0 ; j < MAXNUMNTS ; j++) posStarts(i,j) = -1;
  
  int numFor[MAXNUMNTTS];
  for(i = 0 ; i < MAXNUMNTTS ; i++) numFor[i] = 0;
  FeatureTree* ft = FeatureTree::roots(MCALC);
  for(k = 0 ; k < ft->subtree.size() ; k++)
    {
      FeatureTree* ft2 = ft->subtree.index(k);
      i = ft2->ind(); // i = rule term
      for(l = 0 ; l < ft2->feats.size() ; l++)
	{
	  Feat* f = ft2->feats.index(l);
	  j = f->ind(); //j = rule head term;
	  assert(numFor[j] < MAXNUMNTTS);
	  //cerr << "For posstart " << j << " headphrase = " << i << endl;
	  posStarts(j,numFor[j]) = i;
	  numFor[j]++;
	}
    }
}
Exemplo n.º 2
0
//also need to make lhs of edge a term*, and give edge a start member.
void
Bchart::
add_starter_edges(Item* itm)
{
  if(printDebug() > 140)
    cerr << "add_starter_edges " << *itm << endl;
  ConstTerm* poslhs;
  int ht = itm->term()->toInt();
  int i;
  for(i = 0 ; ; i++)
    {
      int rt = posStarts(ht,i);
      if(rt < 0) break;
      poslhs = Term::fromInt(rt);
      Edge*  nedge = new Edge(poslhs);//???;
      extend_rule(nedge, itm, 0);  //adding head is like extending left;
    }
}