"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ling_class/relation_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).

relation_io.cc  (speech_tools-2.4-release):relation_io.cc  (speech_tools-2.5.0-release)
skipping to change at line 153 skipping to change at line 153
for (p.begin(s.f); p; ++p) for (p.begin(s.f); p; ++p)
*outf << p->k << " " << p->v << endl; *outf << p->k << " " << p->v << endl;
*outf << "#\n"; *outf << "#\n";
/* if (f("timing_style") == "event") /* if (f("timing_style") == "event")
*outf << "timing_style event\n"; *outf << "timing_style event\n";
else if (f("timing_style") == "unit") else if (f("timing_style") == "unit")
*outf << "timing_style unit\n"; *outf << "timing_style unit\n";
*/ */
for (ptr = s.head(); ptr != 0; ptr = ptr->next()) for (ptr = s.head(); ptr != 0; ptr = inext(ptr))
{ {
*outf << "\t"; *outf << "\t";
outf->precision(5); outf->precision(5);
outf->setf(ios::fixed, ios::floatfield); outf->setf(ios::scientific, ios::floatfield);
outf->width(8); outf->width(8);
// outf->fill('0'); // outf->fill('0');
if (s.f("timing_style","0") == "event") if (s.f("timing_style","0") == "event")
*outf << ptr->F("time",0); *outf << ptr->F("time",0);
else else
*outf << ptr->F("end",0); *outf << ptr->F("end",0);
*outf << " 26 \t" << ptr->S("name","0"); *outf << " 26 \t" << ptr->S("name","0");
EST_Features f2; EST_Features f2;
skipping to change at line 281 skipping to change at line 281
a += (d/(double)sample); a += (d/(double)sample);
} }
return a; return a;
} }
} }
EST_read_status read_label_portion(EST_TokenStream &ts, EST_Relation &s, EST_read_status read_label_portion(EST_TokenStream &ts, EST_Relation &s,
int sample) int sample)
{ {
EST_Item *item; EST_Item *item;
float hstart, hend; float hend;
EST_String str; EST_String str;
while(!ts.eof()) while(!ts.eof())
{ {
str = ts.get().string(); str = ts.get().string();
if (str == ".") if (str == ".")
return format_ok; return format_ok;
item = s.append(); item = s.append();
hstart = convert_long_num_string_to_time(str,sample);
str = ts.get().string(); str = ts.get().string();
hend = convert_long_num_string_to_time(str,sample); hend = convert_long_num_string_to_time(str,sample);
item->set("end",hend); // time item->set("end",hend); // time
item->set("name",ts.get().string()); // name item->set("name",ts.get().string()); // name
if (!ts.eoln()) if (!ts.eoln())
item->set("rest_lab",ts.get_upto_eoln().string()); item->set("rest_lab",ts.get_upto_eoln().string());
} }
skipping to change at line 359 skipping to change at line 358
EST_write_status save_htk_label(ostream *outf, EST_write_status save_htk_label(ostream *outf,
const EST_Relation &a) const EST_Relation &a)
{ {
EST_Item *ptr; EST_Item *ptr;
float end,start; float end,start;
outf->precision(6); outf->precision(6);
start = end = 0; start = end = 0;
for (ptr = a.head(); ptr != 0; ptr = ptr->next()) for (ptr = a.head(); ptr != 0; ptr = inext(ptr))
{ {
outf->width(15); outf->width(15);
cout.setf(ios::left,ios::adjustfield); cout.setf(ios::left,ios::adjustfield);
*outf << (int)(start * HTK_UNITS_PER_SECOND); *outf << (int)(start * HTK_UNITS_PER_SECOND);
outf->width(15); outf->width(15);
end = ptr->F("end",0.0); end = ptr->F("end",0.0);
*outf << (int)(end * HTK_UNITS_PER_SECOND); *outf << (int)(end * HTK_UNITS_PER_SECOND);
*outf << " " << ptr->name() << endl; *outf << " " << ptr->name() << endl;
start = end; start = end;
} }
skipping to change at line 398 skipping to change at line 397
cerr << "save_label_spn: can't open label output file \"" cerr << "save_label_spn: can't open label output file \""
<< filename << "\"" << endl; << filename << "\"" << endl;
return write_fail; return write_fail;
} }
ptr = a.head(); ptr = a.head();
outf->precision(3); outf->precision(3);
outf->setf(ios::left, ios::adjustfield); outf->setf(ios::left, ios::adjustfield);
outf->width(8); outf->width(8);
*outf << ptr->name(); *outf << ptr->name();
outf->setf(ios::fixed, ios::floatfield); outf->setf(ios::scientific, ios::floatfield);
outf->width(8); outf->width(8);
*outf << (ptr->dur() * 1000.0) << "\t (0,140)" << endl; *outf << (ptr->dur() * 1000.0) << "\t (0,140)" << endl;
for (; next(ptr) != 0; ptr = ptr->next()) for (; inext(ptr) != 0; ptr = inext(ptr))
{ {
outf->precision(3); outf->precision(3);
outf->setf(ios::left, ios::adjustfield); outf->setf(ios::left, ios::adjustfield);
outf->width(8); outf->width(8);
*outf << ptr->name(); *outf << ptr->name();
outf->setf(ios::fixed, ios::floatfield); outf->setf(ios::scientific, ios::floatfield);
outf->width(8); outf->width(8);
*outf << (ptr->dur() * 1000.0) << endl; *outf << (ptr->dur() * 1000.0) << endl;
} }
// outf->precision(3); // outf->precision(3);
// outf->setf(ios::left, ios::adjustfield); // outf->setf(ios::left, ios::adjustfield);
outf->width(8); outf->width(8);
*outf << ptr->name(); *outf << ptr->name();
outf->setf(ios::fixed, ios::floatfield); outf->setf(ios::scientific, ios::floatfield);
outf->width(8); outf->width(8);
*outf << (ptr->dur() * 1000.0) << "\t (99,80)" << endl; *outf << (ptr->dur() * 1000.0) << "\t (99,80)" << endl;
if (outf != &cout) if (outf != &cout)
delete outf; delete outf;
return write_ok; return write_ok;
} }
EST_write_status save_label_names(const EST_String &filename, EST_write_status save_label_names(const EST_String &filename,
skipping to change at line 445 skipping to change at line 444
else else
outf = new ofstream(filename); outf = new ofstream(filename);
if (!(*outf)) if (!(*outf))
{ {
cerr << "save_label_name: can't open label output file \"" cerr << "save_label_name: can't open label output file \""
<< filename << "\"" << endl; << filename << "\"" << endl;
return misc_write_error; return misc_write_error;
} }
for (ptr = a.head(); next(ptr) != 0; ptr = ptr->next()) for (ptr = a.head(); inext(ptr) != 0; ptr = inext(ptr))
{ {
*outf << ptr->name(); *outf << ptr->name();
if ((features != "") && (features != "OneLine")) if ((features != "") && (features != "OneLine"))
*outf << endl; *outf << endl;
else else
*outf << " "; *outf << " ";
} }
*outf << ptr->name() << endl; *outf << ptr->name() << endl;
skipping to change at line 492 skipping to change at line 491
} }
*outf << "#!MLF!#\n"; // MLF header/identifier *outf << "#!MLF!#\n"; // MLF header/identifier
outf->precision(6); outf->precision(6);
start = end = 0; start = end = 0;
for (p = plist.head(); p != 0; p = p->next()) for (p = plist.head(); p != 0; p = p->next())
{ {
outname = path ? plist(p).name() : basename(plist(p).name()); outname = path ? plist(p).name() : basename(plist(p).name());
*outf << "\"*/" << outname<<"\"\n"; *outf << "\"*/" << outname<<"\"\n";
for (ptr = plist(p).head(); ptr != 0; ptr = ptr->next()) for (ptr = plist(p).head(); ptr != 0; ptr = inext(ptr))
{ {
if (time) if (time)
{ {
outf->width(15); outf->width(15);
cout.setf(ios::left,ios::adjustfield); cout.setf(ios::left,ios::adjustfield);
*outf << (int)(start * HTK_UNITS_PER_SECOND); *outf << (int)(start * HTK_UNITS_PER_SECOND);
outf->width(15); outf->width(15);
end = ptr->F("end",0.0); end = ptr->F("end",0.0);
*outf << (int)(end * HTK_UNITS_PER_SECOND) << " "; *outf << (int)(end * HTK_UNITS_PER_SECOND) << " ";
start = end; start = end;
skipping to change at line 536 skipping to change at line 535
if (!(*outf)) if (!(*outf))
{ {
cerr << "save:WordList: can't open WordList output file \"" cerr << "save:WordList: can't open WordList output file \""
<< filename << "\"\n"; << filename << "\"\n";
return write_fail; return write_fail;
} }
for (p = plist.head(); p != 0; p = p->next()) for (p = plist.head(); p != 0; p = p->next())
{ {
for (ptr = plist(p).head(); ptr->next() != 0; ptr = ptr->next()) for (ptr = plist(p).head(); inext(ptr) != 0; ptr = inext(ptr))
{ {
*outf << ptr->name(); *outf << ptr->name();
if (style == 0) if (style == 0)
*outf << endl; *outf << endl;
else else
*outf << " "; *outf << " ";
} }
if (ptr != 0) if (ptr != 0)
*outf << ptr->name() << endl; *outf << ptr->name() << endl;
} }
skipping to change at line 623 skipping to change at line 622
return format_ok; return format_ok;
} }
static void pad_ends(EST_Relation &s, float length) static void pad_ends(EST_Relation &s, float length)
{ {
// add evenly spaced dummy end values to Relation // add evenly spaced dummy end values to Relation
EST_Item *p; EST_Item *p;
int i; int i;
for (i = 0, p = s.head(); p; p = p->next(), ++i) for (i = 0, p = s.head(); p; p = inext(p), ++i)
p->set("end",(length * float(i)/float(s.length()))); p->set("end",(length * float(i)/float(s.length())));
} }
EST_read_status read_RelationList(EST_RelationList &plist, EST_read_status read_RelationList(EST_RelationList &plist,
EST_StrList &files, EST_Option &al) EST_StrList &files, EST_Option &al)
{ {
EST_Litem *p, *plp; EST_Litem *p, *plp;
if (al.val("-itype", 0) == "mlf") if (al.val("-itype", 0) == "mlf")
{ {
 End of changes. 13 change blocks. 
13 lines changed or deleted 12 lines changed or added

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