40 #ifndef __EST_SCFG_H__ 
   41 #define __EST_SCFG_H__ 
   43 #include "EST_simplestats.h" 
   44 #include "EST_rw_status.h" 
   45 #include "EST_TList.h" 
   62     int find_num_nodes(LISP 
string);
 
   63     int set_leaf_indices(LISP 
string,
int i,LISP *symbols);
 
   64     int num_leafs(LISP l) 
const;
 
   65     void find_valid(
int i,LISP t) 
const;
 
   76     void set_bracketed_string(LISP 
string);
 
   78     int length()
 const {
return p_length;}
 
   80     LISP string()
 const { 
return bs; }
 
   83        { 
return EST_String(get_c_string(car(symbols[i]))); }
 
   85     int valid(
int i,
int k)
 const { 
return valid_spans[i][k]; }
 
   89        { 
return (!(
this == &a)); }
 
   91        { 
return ((
this == &a)); }
 
   94        { (void)a; s << 
"[a bracketed string]" << endl; 
return s; }
 
  101 enum est_scfg_rtype {est_scfg_unset, est_scfg_binary_rule,
 
  102              est_scfg_unary_rule};
 
  126     est_scfg_rtype p_type;
 
  133       {p_mother = r.p_mother; p_daughter1 = r.p_daughter1;
 
  134        p_daughter2 = r.p_daughter2; p_type=r.p_type; p_prob = r.p_prob;}
 
  140     double prob()
 const {
return p_prob;}
 
  144     est_scfg_rtype 
type()
 const { 
return p_type; }
 
  146     int mother()
 const {
return p_mother;}
 
  152     int daughter2()
 const {
return p_daughter2;}
 
  154     void set_rule(
double prob,
int p, 
int m);
 
  156     void set_rule(
double prob,
int p, 
int q, 
int r);
 
  182     int p_distinguished_symbol;
 
  188     void rule_prob_cache();
 
  190     void delete_rule_prob_cache();
 
  208     int distinguished_symbol()
 const { 
return p_distinguished_symbol; }
 
  226     double prob_B(
int p, 
int q, 
int r)
 const { 
return p_prob_B[p][q][r]; }
 
  228     double prob_U(
int p, 
int m)
 const { 
return p_prob_U[p][m]; }
 
  267     double f_I_cal(
int c, 
int p, 
int i, 
int k);
 
  269     double f_I(
int c, 
int p, 
int i, 
int k)
 
  271       if ((r=inside[p][i][k]) != -1) 
return r;
 
  272       else return f_I_cal(c,p,i,k); }
 
  274     double f_O_cal(
int c, 
int p, 
int i, 
int k);
 
  276     double f_O(
int c, 
int p, 
int i, 
int k)
 
  278       if ((r=outside[p][i][k]) != -1) 
return r;
 
  279       else return f_O_cal(c,p,i,k); }
 
  285     double f_P(
int c,
int p);
 
  287     void reestimate_rule_prob_B(
int c, 
int ri, 
int p, 
int q, 
int r);
 
  289     void reestimate_rule_prob_U(
int c, 
int ri, 
int p, 
int m);
 
  291     void reestimate_grammar_probs(
int passes,
 
  297     double cross_entropy();
 
  299     void init_io_cache(
int c,
int nt);
 
  301     void clear_io_cache(
int c);
 
  345 LISP scfg_bracketing_only(LISP parse);