"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "grammar/ngram/ngrammar_io.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).

ngrammar_io.cc  (speech_tools-2.4-release):ngrammar_io.cc  (speech_tools-2.5.0-release)
skipping to change at line 172 skipping to change at line 172
for (k=0; ((k<i) && !ts.eof()); k++) for (k=0; ((k<i) && !ts.eof()); k++)
window[k] = ts.get().string(); window[k] = ts.get().string();
if(ts.eof()) if(ts.eof())
{ {
cerr << "Unexpected end of file whilst reading " << i cerr << "Unexpected end of file whilst reading " << i
<< "-grams !" << endl; << "-grams !" << endl;
return misc_read_error; return misc_read_error;
} }
occur = atof(ts.get().string());
// can't for backoff grammars, need to set probs directly // can't for backoff grammars, need to set probs directly
cerr << "ooooooooops" << endl; cerr << "ooooooooops" << endl;
return wrong_format; return wrong_format;
//n.accumulate(window,occur);
occur = atof(ts.get().string());
n.accumulate(window,occur);
// backoff weight ? // backoff weight ?
if (!ts.eoln()) if (!ts.eoln())
{ {
weight = atof(ts.get().string()); weight = atof(ts.get().string());
n.set_backoff_weight(window,weight); n.set_backoff_weight(window,weight);
} }
if (!ts.eoln()) if (!ts.eoln())
{ {
skipping to change at line 651 skipping to change at line 651
} }
} }
EST_write_status EST_write_status
save_ngram_arpa(const EST_String filename, EST_Ngrammar &n) save_ngram_arpa(const EST_String filename, EST_Ngrammar &n)
{ {
// ARPA MIT-LL format - see HTK manual !! // ARPA MIT-LL format - see HTK manual !!
ostream *ost; ostream *ost;
int i,num_n,o; int i,o;
if (filename == "-") if (filename == "-")
ost = &cout; ost = &cout;
else else
ost = new ofstream(filename); ost = new ofstream(filename);
if (!(*ost)) if (!(*ost))
return write_fail; return write_fail;
//n.set_entry_type(EST_Ngrammar::probabilities); //n.set_entry_type(EST_Ngrammar::probabilities);
//n.make_htk_compatible(); // fix enter/exit probs //n.make_htk_compatible(); // fix enter/exit probs
//*ost << *(n.vocab) << endl; //*ost << *(n.vocab) << endl;
// count number of ngrams
num_n = (int)n.samples();
*ost << "\\data\\" << endl; *ost << "\\data\\" << endl;
double *count = new double; double *count = new double;
if (n.representation() == EST_Ngrammar::backoff) if (n.representation() == EST_Ngrammar::backoff)
{ {
for(o=1;o<=n.order();o++) for(o=1;o<=n.order();o++)
{ {
EST_StrVector ngram(o); EST_StrVector ngram(o);
for(i=0;i<o;i++) for(i=0;i<o;i++)
 End of changes. 4 change blocks. 
6 lines changed or deleted 4 lines changed or added

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