"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ling_class/EST_UtteranceFile.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_UtteranceFile.cc  (speech_tools-2.4-release):EST_UtteranceFile.cc  (speech_tools-2.5.0-release)
skipping to change at line 322 skipping to change at line 322
EST_TKVL<void *,int> &sinames, EST_TKVL<void *,int> &sinames,
int &si_count) int &si_count)
{ {
if (n == 0) if (n == 0)
return write_ok; return write_ok;
else else
{ {
utt_save_ling_content(outf,n,sinames,si_count); utt_save_ling_content(outf,n,sinames,si_count);
// As we have more complex structures this will need to // As we have more complex structures this will need to
// be updated (i.e. we'll need a marking method for nodes) // be updated (i.e. we'll need a marking method for nodes)
utt_save_all_contents(outf,n->next(),sinames,si_count); utt_save_all_contents(outf,inext(n),sinames,si_count);
utt_save_all_contents(outf,n->down(),sinames,si_count); utt_save_all_contents(outf,idown(n),sinames,si_count);
} }
return write_ok; return write_ok;
} }
static EST_write_status utt_save_ling_content(ostream &outf, static EST_write_status utt_save_ling_content(ostream &outf,
EST_Item *si, EST_Item *si,
EST_TKVL<void *,int> &sinames, EST_TKVL<void *,int> &sinames,
int &si_count) int &si_count)
{ {
// Save item and features if not already saved // Save item and features if not already saved
skipping to change at line 366 skipping to change at line 366
status = rel->load("", ts, "esps"); status = rel->load("", ts, "esps");
EST_Item *i = rel->head(); EST_Item *i = rel->head();
float t=0.0; float t=0.0;
while (i != NULL) while (i != NULL)
{ {
i->set("start", t); i->set("start", t);
t = i->F("end"); t = i->F("end");
i = i->next(); i = inext(i);
} }
return status; return status;
} }
EST_write_status EST_UtteranceFile::save_xlabel(ostream &outf, EST_write_status EST_UtteranceFile::save_xlabel(ostream &outf,
const EST_Utterance &utt) const EST_Utterance &utt)
{ {
EST_write_status status = write_error; EST_write_status status = write_error;
EST_Relation *rel; EST_Relation *rel;
EST_Features::Entries p; EST_Features::Entries p;
for (p.begin(utt.relations); p; p++) for (p.begin(utt.relations); p; p++)
{ {
rel = ::relation(p->v); rel = ::relation(p->v);
EST_Item * hd = rel->head(); EST_Item * hd = rel->head();
while (hd) while (hd)
{ {
if (hd->up() || hd->down()) if (iup(hd) || idown(hd))
break; break;
hd=hd->next(); hd=inext(hd);
} }
// didn't find anything => this is linear // didn't find anything => this is linear
if(!hd) if(!hd)
return rel->save(outf, "esps", 0); return rel->save(outf, "esps", 0);
} }
// Found no linear relations // Found no linear relations
return status; return status;
} }
#if defined(INCLUDE_XML_FORMATS) #if defined(INCLUDE_XML_FORMATS)
#include "genxml.h" #include "genxml.h"
#include "apml.h" #include "apml.h"
// APML support // APML support
EST_read_status EST_UtteranceFile::load_apml(EST_TokenStream &ts, EST_read_status EST_UtteranceFile::load_apml(EST_TokenStream &ts,
EST_Utterance &u, EST_Utterance &u,
skipping to change at line 480 skipping to change at line 480
if (stat != read_ok) if (stat != read_ok)
fseek(stream, pos, 0); fseek(stream, pos, 0);
return stat; return stat;
} }
EST_write_status EST_UtteranceFile::save_genxml(ostream &outf, EST_write_status EST_UtteranceFile::save_genxml(ostream &outf,
const EST_Utterance &utt) const EST_Utterance &utt)
{ {
EST_write_status status=write_ok; EST_write_status status=write_ok;
EST_TStringHash<int> features(20);
EST_TStringHash<int> features(20); EST_Features::Entries p;
EST_Features::Entries p;
for (p.begin(utt.relations); p; ++p) for (p.begin(utt.relations); p; ++p)
{ {
EST_Relation *rel = ::relation(p->v); EST_Relation *rel = ::relation(p->v);
EST_Item * hd = rel->head();
EST_Item * hd = rel->head(); while (hd)
while (hd)
{ {
EST_Features::Entries fp; EST_Features::Entries fp;
for (fp.begin(hd->features()); fp; ++fp) for (fp.begin(hd->features()); fp; ++fp)
features.add_item(fp->k, 1); features.add_item(fp->k, 1);
hd=hd->next(); hd=inext(hd);
} }
} }
outf << "<?xml version='1.0'?>\n"; outf << "<?xml version='1.0'?>\n";
outf << "<!DOCTYPE utterance PUBLIC '//CSTR EST//DTD cstrutt//EN' 'cstrutt.dtd '\n\t[\n"; outf << "<!DOCTYPE utterance PUBLIC '//CSTR EST//DTD cstrutt//EN' 'cstrutt.d td'\n\t[\n";
EST_TStringHash<int>::Entries f; EST_TStringHash<int>::Entries f;
outf << "\t<!ATTLIST item\n"; outf << "\t<!ATTLIST item\n";
for (f.begin(features); f; ++f) for (f.begin(features); f; ++f)
{ {
if (f->k != "id") if (f->k != "id")
{ {
outf << "\t\t" << f->k << "\tCDATA #IMPLIED\n"; outf << "\t\t" << f->k << "\tCDATA #IMPLIED\n";
} }
} }
outf << "\t\t>\n"; outf << "\t\t>\n";
outf << "\t]>\n";
outf << "\t]>\n"; outf << "<utterance>\n";
outf << "<language name='unknown'/>\n";
outf << "<utterance>\n";
outf << "<language name='unknown'/>\n"; for (p.begin(utt.relations); p; ++p)
for (p.begin(utt.relations); p; ++p)
{ {
EST_Relation *rel = ::relation(p->v); EST_Relation *rel = ::relation(p->v);
EST_Item * hd = rel->head(); EST_Item * hd = rel->head();
while (hd) while (hd)
{ {
if (hd->up() || hd->down()) if (iup(hd) || idown(hd))
break; break;
hd=hd->next(); hd=inext(hd);
} }
// didn't find anything => this is linear // didn't find anything => this is linear
if(!hd) if(!hd)
{ {
outf << "<relation name='"<< rel->name()<< "' structure-type='list'>\n" ; outf << "<relation name='"<< rel->name()<< "' structure-type='list'> \n";
hd = rel->head(); hd = rel->head();
while (hd) while (hd)
{ {
outf << " <item\n"; outf << " <item\n";
EST_Features::Entries p; EST_Features::Entries p;
for (p.begin(hd->features()); p; ++p) for (p.begin(hd->features()); p; ++p)
if (p->k != "estContentFeature") if (p->k != "estContentFeature")
outf << " " << p->k << "='" << p->v << "'\n"; outf << " " << p->k << "='" << p->v << "'\n";
outf << " />\n"; outf << " />\n";
hd=hd->next(); hd=inext(hd);
} }
outf << "</relation>\n"; outf << "</relation>\n";
} }
else // for now give an error for non-linear relations else // for now give an error for non-linear relations
status=write_partial; status=write_partial;
} }
outf << "</utterance>\n"; outf << "</utterance>\n";
return status; return status;
; ;
} }
#endif #endif
EST_String EST_UtteranceFile::options_short(void) EST_String EST_UtteranceFile::options_short(void)
{ {
EST_String s(""); EST_String s("");
for(int n=0; n< EST_UtteranceFile::map.n() ; n++) for(int n=0; n< EST_UtteranceFile::map.n() ; n++)
{ {
EST_UtteranceFileType type = EST_UtteranceFile::map.nth_token(n); EST_UtteranceFileType type = EST_UtteranceFile::map.nth_token(n);
 End of changes. 39 change blocks. 
74 lines changed or deleted 68 lines changed or added

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