"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "grammar/scfg/EST_SCFG_Chart.cc" between
speech_tools-2.4-release.tar.gz and speech_tools-2.5.0-release.tar.gz

About: The speech_tools - Edinburgh Speech Tools Library (used by the Festival Speech Synthesis System).

EST_SCFG_Chart.cc  (speech_tools-2.4-release):EST_SCFG_Chart.cc  (speech_tools-2.5.0-release)
skipping to change at line 152 skipping to change at line 152
} }
void EST_SCFG_Chart::setup_wfst(EST_Item *s, EST_Item *e,const EST_String &name) void EST_SCFG_Chart::setup_wfst(EST_Item *s, EST_Item *e,const EST_String &name)
{ {
// Set up well formed substring table from feature name in each // Set up well formed substring table from feature name in each
// stream item in s // stream item in s
EST_Item *p; EST_Item *p;
int n; int n;
delete_edge_table(); delete_edge_table();
for (n_vertices=1,p=s; p != e; p=p->next()) for (n_vertices=1,p=s; p != e; p=inext(p))
n_vertices++; n_vertices++;
setup_edge_table(); setup_edge_table();
for (n=0,p=s; p != e; p=p->next(),n++) for (n=0,p=s; p != e; p=inext(p),n++)
{ {
int term = grammar->terminal(p->f(name).string()); int term = grammar->terminal(p->f(name).string());
if (term == -1) if (term == -1)
{ {
cerr << "SCFG_Chart: unknown terminal symbol \"" << cerr << "SCFG_Chart: unknown terminal symbol \"" <<
p->f(name).string() << "\"" << endl; p->f(name).string() << "\"" << endl;
term = 0; // to avoid crashing term = 0; // to avoid crashing
} }
wfst[n] = new EST_SCFG_Chart_Edge(1.0,term,0,-1); wfst[n] = new EST_SCFG_Chart_Edge(1.0,term,0,-1);
} }
skipping to change at line 318 skipping to change at line 318
} }
void EST_SCFG_Chart::extract_parse(EST_Relation *syn, void EST_SCFG_Chart::extract_parse(EST_Relation *syn,
EST_Item *s, EST_Item *e, int force) EST_Item *s, EST_Item *e, int force)
{ {
// Build a tree stream in Syn linking the leafs of Syn to those // Build a tree stream in Syn linking the leafs of Syn to those
// in word // in word
EST_Item *p; EST_Item *p;
int num_words; int num_words;
for (num_words=0,p=s; p != e; p=p->next()) for (num_words=0,p=s; p != e; p=inext(p))
num_words++; num_words++;
if (num_words != (n_vertices-1)) if (num_words != (n_vertices-1))
{ {
cerr << "SCFG_Chart: extract_parse, number of items in link stream " << cerr << "SCFG_Chart: extract_parse, number of items in link stream " <<
" different from those in parse tree" << endl; " different from those in parse tree" << endl;
return; return;
} }
EST_SCFG_Chart_Edge *top; EST_SCFG_Chart_Edge *top;
skipping to change at line 366 skipping to change at line 366
s->append_daughter(w); s->append_daughter(w);
s->set_name(grammar->nonterminal(grammar->distinguished_symbol())); s->set_name(grammar->nonterminal(grammar->distinguished_symbol()));
s->set("prob",0.0); // maybe should be epsilon s->set("prob",0.0); // maybe should be epsilon
} }
else else
{ {
extract_forced_parse(start,start+1,s->append_daughter(),w); extract_forced_parse(start,start+1,s->append_daughter(),w);
EST_Item *st = s->append_daughter(); EST_Item *st = s->append_daughter();
st->set_name(grammar->nonterminal(grammar->distinguished_symbol())); st->set_name(grammar->nonterminal(grammar->distinguished_symbol()));
st->set("prob",0.0); // maybe should be epsilon st->set("prob",0.0); // maybe should be epsilon
EST_Item *nw = w->next(); EST_Item *nw = inext(w);
extract_forced_parse(start+1,end,st,nw); extract_forced_parse(start+1,end,st,nw);
} }
} }
void EST_SCFG_Chart::extract_edge(int start, int end, int p, void EST_SCFG_Chart::extract_edge(int start, int end, int p,
EST_SCFG_Chart_Edge *e, EST_SCFG_Chart_Edge *e,
EST_Item *s, EST_Item *s,
EST_Item **word) EST_Item **word)
{ {
// Build the node for this edge, and all of its daughters // Build the node for this edge, and all of its daughters
skipping to change at line 388 skipping to change at line 388
if (e->prob() == 0) if (e->prob() == 0)
{ {
return; // failed return; // failed
} }
else if (start+1 == end) else if (start+1 == end)
{ {
// unary rule, preterminal // unary rule, preterminal
s->append_daughter((*word)); s->append_daughter((*word));
s->set_name(grammar->nonterminal(p)); s->set_name(grammar->nonterminal(p));
s->set("prob",(float)e->prob()); s->set("prob",(float)e->prob());
*word = (*word)->next(); // increment along "word" stream *word = inext(*word); // increment along "word" stream
return; return;
} }
else else
{ {
//name prob start end daughters //name prob start end daughters
EST_SCFG_Chart_Edge *d1, *d2; EST_SCFG_Chart_Edge *d1, *d2;
d1 = edges[start][e->pos()][e->d1()]; d1 = edges[start][e->pos()][e->d1()];
d2 = edges[e->pos()][end][e->d2()]; d2 = edges[e->pos()][end][e->d2()];
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)