48class EST_PredictionSuffixTree_tree_node {
57 void delete_node(
void *n) {
if (n != 0)
delete (EST_PredictionSuffixTree_tree_node *)n;}
64 EST_PredictionSuffixTree_tree_node() {p_level=0;}
65 ~EST_PredictionSuffixTree_tree_node();
67 const EST_String &get_path(
void)
const {
return path;}
69 void set_level(
int l) {p_level=l;}
70 void set_state(
int s) {state=s;}
71 int get_state(
void)
const {
return state;}
72 int get_level(
void)
const {
return p_level;}
73 void cumulate(
const EST_String &s,
double count=1) {pd.cumulate(s,count);}
74 void cumulate(
const int i,
double count=1) {pd.cumulate(i,count);}
75 const EST_String &most_probable(
double *p)
const;
77 void print_freqs(ostream &os);
78 void print_probs(ostream &os);
83class EST_PredictionSuffixTree {
87 enum EST_filetype {PredictionSuffixTree_ascii, PredictionSuffixTree_binary};
96 const EST_StrVector &words,
97 double *prob,
int *state,
98 const int index=0)
const;
101 const EST_StrVector &words,
107 const EST_StrVector &words,
108 const int index=0)
const;
110 EST_PredictionSuffixTree();
111 EST_PredictionSuffixTree(
const int order) {init(order);}
112 EST_PredictionSuffixTree(
const EST_String filename);
114 ~EST_PredictionSuffixTree();
116 void init(
const int order);
117 double samples()
const {
return pd->samples(); }
118 int states()
const {
return num_states; }
119 int order(
void)
const {
return p_order;}
120 void accumulate(
const EST_StrVector &words,
const double count=1,
const int index=0);
123 int save(
const EST_String filename,
const EST_PredictionSuffixTree::EST_filetype type=PredictionSuffixTree_ascii);
131 void build(
const EST_StrList &input);
134 void print_freqs(ostream &os);
135 void print_probs(ostream &os);
137 const EST_String &predict(
const EST_StrVector &words)
const;
138 const EST_String &predict(
const EST_StrVector &words,
double *prob)
const;
139 const EST_String &predict(
const EST_StrVector &words,
double *prob,
int *state)
const;
142 {
return p_prob_dist(nodes,words);}
144 double rev_prob(
const EST_StrVector &words)
const;
145 double rev_prob(
const EST_StrVector &words,