コード例 #1
0
ファイル: Bchart.C プロジェクト: chrisleewashere/SwiRL-OSX
float
Bchart::
meEdgeProb(const Term* trm, Edge* edge, int whichInt)
{
  FullHist fh(edge);
  float ans =  meFHProb(trm, fh, whichInt);
  return ans;
}
コード例 #2
0
void
Bchart::
assignRProb(Edge* edge)
{
  LeftRightGotIter lrgi(edge);
  globalGi = &lrgi;
  int sz = lrgi.size();
  int i;
  int hp = edge->headPos();
  double ans = 1;
  cerr << "ARP " << *edge << endl;
  for(i = 0 ; i < sz ; i++)
    {
      lrgi.pos() = i;
      int whichInt = i < hp ? LCALC : i == hp ? MCALC : RCALC;
      FullHist fh(edge);
      fh.pos = i;
      double p = meFHProb(lrgi.index(i)->term(),fh, whichInt);
      //cerr << "p" << whichInt << "(" << *lrgi.index(i) << ")= " << p << endl;
      ans *= p;
    }
  //if(ans == 0) cerr << "Assigned zero prob to " << *edge << endl;
  edge->prob() = ans;
}