Edinburgh Speech Tools  2.1-release
EST_UtteranceFile.cc
Go to the documentation of this file.
1  /************************************************************************/
2  /* */
3  /* Centre for Speech Technology Research */
4  /* University of Edinburgh, UK */
5  /* Copyright (c) 1996,1997 */
6  /* All Rights Reserved. */
7  /* */
8  /* Permission is hereby granted, free of charge, to use and distribute */
9  /* this software and its documentation without restriction, including */
10  /* without limitation the rights to use, copy, modify, merge, publish, */
11  /* distribute, sublicense, and/or sell copies of this work, and to */
12  /* permit persons to whom this work is furnished to do so, subject to */
13  /* the following conditions: */
14  /* 1. The code must retain the above copyright notice, this list of */
15  /* conditions and the following disclaimer. */
16  /* 2. Any modifications must be clearly marked as such. */
17  /* 3. Original authors' names are not deleted. */
18  /* 4. The authors' names are not used to endorse or promote products */
19  /* derived from this software without specific prior written */
20  /* permission. */
21  /* */
22  /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23  /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24  /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25  /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26  /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27  /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28  /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29  /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30  /* THIS SOFTWARE. */
31  /* */
32  /*************************************************************************/
33  /* */
34  /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */
35  /* -------------------------------------------------------------------- */
36  /* Functions to load and save utterances in various formats. */
37  /* */
38  /*************************************************************************/
39 
40 #include <cstdlib>
41 #include <cstdio>
42 #include <iostream>
43 #include <fstream>
44 #include "EST_string_aux.h"
45 #include "EST_FileType.h"
46 #include "EST_Token.h"
48 #include "EST_UtteranceFile.h"
49 #include "EST_File.h"
50 
51 using namespace std;
52 
53 static EST_read_status load_all_contents(EST_TokenStream &ts,
54 // EST_THash<int,EST_Val> &sitems,
56  int &max_id);
57 static EST_read_status load_relations(EST_TokenStream &ts,
58  EST_Utterance &utt,
60 // const EST_THash<int,EST_Val> &sitems
61  );
62 // static EST_write_status save_est_ascii(ostream &outf,const EST_Utterance &utt);
63 static EST_write_status utt_save_all_contents(ostream &outf,
64  const EST_Utterance &utt,
65  EST_TKVL<void *,int> &sinames);
66 static EST_write_status utt_save_all_contents(ostream &outf,
67  EST_Item *n,
68  EST_TKVL<void *,int> &sinames,
69  int &si_count);
70 static EST_write_status utt_save_ling_content(ostream &outf,
71  EST_Item *si,
72  EST_TKVL<void *,int> &sinames,
73  int &si_count);
74 
75 static void node_tidy_up(ssize_t &k, EST_Item_Content *node)
76 {
77  // Called to delete the nodes in the hash table when a load
78  (void)k;
79 
80  if (node->unref_relation("__READ__"))
81  delete node;
82 }
83 
85  EST_Utterance &u,
86  int &max_id)
87 {
88  EST_Option hinfo;
89  bool ascii;
92  // EST_THash<int,EST_Val> sitems(100);
93 
95 
96  // set up the character constant values for this stream
97  ts.set_SingleCharSymbols(";()");
98  ts.set_quotes('"','\\');
99 
100  if ((r = read_est_header(ts, hinfo, ascii, t)) != format_ok)
101  return r;
102  if (t != est_file_utterance)
103  return misc_read_error;
104  if (hinfo.ival("version") != 2)
105  {
106  if (hinfo.ival("version") == 3)
107  EST_warning("Loading est utterance format version 3, ladders will not be understood");
108  else
109  {
110  EST_error("utt_load: %s wrong version of utterance format expected 2 (or 3) but found %d",
111  (const char *)ts.pos_description(), hinfo.ival("version"));
112  }
113  }
114 
115  // Utterance features
116  if (ts.get() != "Features")
117  {
118  cerr << "utt_load: " << ts.pos_description() <<
119  " missing utterance features section" << endl;
120  return misc_read_error;
121  }
122  else
123  u.f.load(ts);
124  // items
125  if (ts.get() != "Stream_Items")
126  {
127  cerr << "utt_load: " << ts.pos_description() <<
128  " missing Items section" << endl;
129  return misc_read_error;
130  }
131  max_id = 0;
132  r = load_all_contents(ts, sitems, max_id);
133 
134  // Only exist in older form utterances so soon wont be necessary
135  if (ts.peek() == "Streams")
136  {
137  cerr << "utt.load: streams found in utterance file, " <<
138  "no longer supported" << endl;
139  return misc_read_error;
140  }
141 
142  // Relations
143  if ((r == format_ok) && (ts.get() != "Relations"))
144  {
145  cerr << "utt_load: " << ts.pos_description() <<
146  " missing Relations section" << endl;
147  return misc_read_error;
148  }
149 
150  r = load_relations(ts, u, sitems);
151 
152  if ((r == format_ok) && (ts.get() != "End_of_Utterance"))
153  {
154  cerr << "utt_load: " << ts.pos_description() <<
155  " End_of_Utterance expected but not found" << endl;
156  return misc_read_error;
157  }
158 
159  // if (r != format_ok)
160  // {
161  // This works because even if some of these si's have been
162  // linked to nodes they will be unlink when the si is destroyed
163  for(ssize_t ni=0; ni < sitems.length(); ni++)
164  {
165  EST_Item_Content *c = sitems[ni];
166  if (c != NULL)
167  node_tidy_up(ni, c);
168  }
169  // }
170 
171  return r;
172 
173 }
174 
175 static EST_read_status load_all_contents(EST_TokenStream &ts,
176 // EST_THash<int,EST_Val> &sitems,
178  int &max_id)
179 {
180  // Load items into table with names for later reference
181  // by relations
182  EST_String Sid;
183  bool ok;
184  ssize_t id;
185  int idval;
186 
187  while (ts.peek() != "End_of_Stream_Items")
188  {
190 
191  si->relations.add_item("__READ__", est_val((EST_Item *)NULL), 1);
192 
193  Sid = ts.get().string();
194 
195  id = Sid.Int(ok);
196  if (!ok)
197  {
198  cerr << "utt_load: " << ts.pos_description() <<
199  " Item name not a number: " << Sid << endl;
200  delete si;
201  return misc_read_error;
202  }
203  if (id >= sitems.length())
204  {
205  sitems.resize(id*2, 1);
206  }
207  sitems[id] = si;
208  // sitems.add_item(id,est_val(si));
209  if (si->f.load(ts) != format_ok)
210  return misc_read_error;
211  idval = si->f.I("id",0);
212  if (idval > max_id)
213  max_id = idval;
214  if (ts.eof())
215  return misc_read_error; // just in case this happens
216  }
217 
218  ts.get(); // skip "End_of_Stream_Items"
219 
220  return format_ok;
221 }
222 
223 static EST_read_status load_relations(EST_TokenStream &ts,
224  EST_Utterance &utt,
226 // const EST_THash<int,EST_Val> &sitems
227  )
228 {
229  // Load relations
230 
231  while (ts.peek() != "End_of_Relations")
232  {
233  // can't use create relation as we don't know its name until
234  // after its loaded
235  EST_Relation *r = new EST_Relation;
236 
237  if (r->load(ts,sitems) != format_ok) {
238  delete r;
239  return misc_read_error;
240  }
241  r->set_utt(&utt);
242  utt.relations.set_val(r->name(),est_val(r));
243 
244  if (ts.eof())
245  return misc_read_error;
246  }
247 
248  ts.get(); // Skip "End_of_Relations"
249 
250  return format_ok;
251 }
252 
253 
255 {
257 
258  std::streamsize oldprecision = outf.precision(8);
259  std::ios_base::fmtflags oldsetf = outf.setf(ios::fixed, ios::floatfield);
260  std::streamsize oldwidth = outf.width(8);
261 
262  outf << "EST_File utterance\n"; // EST header identifier.
263  outf << "DataType ascii\n";
264  outf << "version 2\n";
265  outf << "EST_Header_End\n"; // EST end of header identifier.
266 
267  // Utterance features
268  outf << "Features ";
269  utt.f.save(outf);
270  outf << endl;
271 
272  outf << "Stream_Items\n";
273  EST_TKVL<void *,int> sinames;
274  v = utt_save_all_contents(outf,utt,sinames);
275  if (v == write_fail) return v;
276  outf << "End_of_Stream_Items\n";
277 
278  // Relations
279  outf << "Relations\n";
281  for (p.begin(utt.relations); p; p++)
282  {
283  v = relation(p->v)->save(outf,sinames);
284  if (v == write_fail) return v;
285  }
286  outf << "End_of_Relations\n";
287 
288  outf << "End_of_Utterance\n";
289 
290  outf.precision(oldprecision);
291  outf.setf(oldsetf);
292  outf.width(oldwidth);
293 
294 
295  return write_ok;
296 }
297 
298 static EST_write_status utt_save_all_contents(ostream &outf,
299  const EST_Utterance &utt,
300  EST_TKVL<void *,int> &sinames)
301 {
302  // Write out all stream items in the utterance, as they may appear in
303  // various places in an utterance keep a record of which ones
304  // have been printed and related them to names for reference by
305  // the Relations (and older Stream architecture).
306  int si_count = 1;
308 
309  // Find the stream items in the relations
311  for (p.begin(utt.relations); p; p++)
312  {
313  v = utt_save_all_contents(outf,relation(p->v)->head(),
314  sinames,si_count);
315  if (v == write_fail) return v;
316  }
317 
318  return v;
319 }
320 
321 static EST_write_status utt_save_all_contents(ostream &outf,
322  EST_Item *n,
323  EST_TKVL<void *,int> &sinames,
324  int &si_count)
325 {
326  if (n == 0)
327  return write_ok;
328  else
329  {
330  utt_save_ling_content(outf,n,sinames,si_count);
331  // As we have more complex structures this will need to
332  // be updated (i.e. we'll need a marking method for nodes)
333  utt_save_all_contents(outf,n->next(),sinames,si_count);
334  utt_save_all_contents(outf,n->down(),sinames,si_count);
335  }
336  return write_ok;
337 }
338 
339 static EST_write_status utt_save_ling_content(ostream &outf,
340  EST_Item *si,
341  EST_TKVL<void *,int> &sinames,
342  int &si_count)
343 {
344  // Save item and features if not already saved
345 
346  if ((si != 0) && (!sinames.present(si->contents())))
347  {
348  sinames.add_item(si->contents(),si_count);
349  outf << si_count << " ";
350  si->features().save(outf);
351  outf << endl;
352  si_count++;
353  }
354  return write_ok;
355 }
356 
358  EST_Utterance &u,
359  int &max_id)
360 {
361  (void)max_id;
362  EST_read_status status = read_ok;
363 
364  u.clear();
365 
366  EST_Relation *rel = u.create_relation("labels");
367 
368  status = rel->load("", ts, "esps");
369 
370  EST_Item *i = rel->head();
371  float t=0.0;
372 
373  while (i != NULL)
374  {
375  i->set("start", t);
376  t = i->F("end");
377  i = i->next();
378  }
379 
380  return status;
381 }
382 
384  const EST_Utterance &utt)
385 {
386  EST_write_status status = write_error;
387 
388  EST_Relation *rel;
389 
391 
392  for (p.begin(utt.relations); p; p++)
393  {
394  rel = ::relation(p->v);
395 
396  EST_Item * hd = rel->head();
397 
398 
399  while (hd)
400  {
401  if (hd->up() || hd->down())
402  break;
403  hd=hd->next();
404  }
405 
406  // didn't find anything => this is linear
407  if(!hd)
408  return rel->save(outf, "esps", 0);
409  }
410 
411  // Found no linear relations
412 
413  return status;
414 }
415 
416 #if defined(INCLUDE_XML_FORMATS)
417 
418 #include "genxml.h"
419 #include "apml.h"
420 
421 // APML support
423  EST_Utterance &u,
424  int &max_id)
425 {
426  FILE *stream;
427 
428  if ((stream=ts.filedescriptor())==NULL)
429  return read_error;
430 
431  EST_FilePos pos=EST_ftell(stream);
432 
433  {
434 
435  char buf[81];
436  buf[0] = 0;
437  if (fgets(buf, 80, stream) == NULL)
438  {
439  if (ferror(stream)) {
440  cerr << "Error reading xml header" << endl;
441  return read_error;
442  }
443  }
444  if (strncmp(buf, "<?xml", 5) != 0)
445  return read_format_error;
446 
447  buf[0] = 0;
448  if (fgets(buf, 80, stream) == NULL)
449  {
450  if (ferror(stream)) {
451  cerr << "Error reading DOCTYPE apml header" << endl;
452  return read_error;
453  }
454  }
455 
456  if (strncmp(buf, "<!DOCTYPE apml", 14) != 0)
457  return read_format_error;
458  }
459 
460  if (EST_fseek(stream, pos, 0) != 0) {
461  cerr << "Error reading DOCTYPE apml header" << endl;
462  return read_error;
463  }
464 
465  EST_read_status stat = apml_read(stream, ts.filename(),u, max_id);
466 
467  if (stat != read_ok)
468  EST_fseek(stream, pos, 0);
469 
470  return stat;
471 }
472 
473 
474 // GenXML support
475 
477  EST_Utterance &u,
478  int &max_id)
479 {
480  FILE *stream;
481 
482  if ((stream=ts.filedescriptor())==NULL)
483  return read_error;
484 
485  EST_FilePos pos=EST_ftell(stream);
486  if (pos < 0 ) {
487  cerr << "Error reading xml header" << endl;
488  return read_error;
489  }
490 
491  {
492  char buf[81];
493  buf[0] = 0;
494  if (fgets(buf, 80, stream) == NULL)
495  {
496  if (ferror(stream)) {
497  cerr << "Error reading xml header" << endl;
498  return read_error;
499  }
500 
501  }
502  if (strncmp(buf, "<?xml", 5) != 0)
503  return read_format_error;
504  }
505 
506  if (EST_fseek(stream, pos, 0) != 0) {
507  cerr << "Error reading xml file" << endl;
508  return read_error;
509  }
510 
511  EST_read_status stat = EST_GenXML::read_xml(stream, ts.filename(),u, max_id);
512 
513  if (stat != read_ok)
514  EST_fseek(stream, pos, 0);
515 
516  return stat;
517 }
518 
520  const EST_Utterance &utt)
521 {
522  EST_write_status status=write_ok;
523 
524  EST_TStringHash<int> features(20);
525 
527 
528  for (p.begin(utt.relations); p; ++p)
529  {
530  EST_Relation *rel = ::relation(p->v);
531 
532  EST_Item * hd = rel->head();
533 
534  while (hd)
535  {
537  for (fp.begin(hd->features()); fp; ++fp)
538  features.add_item(fp->k, 1);
539  hd=hd->next();
540  }
541  }
542 
543  outf << "<?xml version='1.0'?>\n";
544 
545  outf << "<!DOCTYPE utterance PUBLIC '//CSTR EST//DTD cstrutt//EN' 'cstrutt.dtd'\n\t[\n";
546 
548 
549  outf << "\t<!ATTLIST item\n";
550  for (f.begin(features); f; ++f)
551  {
552  if (f->k != "id")
553  {
554  outf << "\t\t" << f->k << "\tCDATA #IMPLIED\n";
555  }
556  }
557 
558  outf << "\t\t>\n";
559 
560  outf << "\t]>\n";
561 
562  outf << "<utterance>\n";
563 
564  outf << "<language name='unknown'/>\n";
565 
566  for (p.begin(utt.relations); p; ++p)
567  {
568  EST_Relation *rel = ::relation(p->v);
569 
570  EST_Item * hd = rel->head();
571 
572 
573  while (hd)
574  {
575  if (hd->up() || hd->down())
576  break;
577  hd=hd->next();
578  }
579 
580  // didn't find anything => this is linear
581  if(!hd)
582  {
583  outf << "<relation name='"<< rel->name()<< "' structure-type='list'>\n";
584 
585  hd = rel->head();
586  while (hd)
587  {
588  outf << " <item\n";
589 
591  for (p.begin(hd->features()); p; ++p)
592  if (p->k != "estContentFeature")
593  outf << " " << p->k << "='" << p->v << "'\n";
594 
595  outf << " />\n";
596 
597  hd=hd->next();
598  }
599 
600  outf << "</relation>\n";
601  }
602  else // for now give an error for non-linear relations
603  status=write_partial;
604  }
605 
606 
607  outf << "</utterance>\n";
608 
609  return status;
610 ;
611 }
612 #endif
613 
615 {
616  EST_String s("");
617 
618  for(int n=0; n< EST_UtteranceFile::map.n() ; n++)
619  {
621  if (type != uff_none)
622  {
623  for(int ni=0; ni<NAMED_ENUM_MAX_SYNONYMS; ni++)
624  {
625  const char *nm = EST_UtteranceFile::map.name(type, ni);
626  if (nm==NULL)
627  break;
628 
629  if (s != "")
630  s += ", ";
631 
632  s += nm;
633  }
634  }
635  }
636  return s;
637 }
638 
640 {
641  EST_String s("Available utterance file formats:\n");
642 
643  for(int n=0; n< EST_UtteranceFile::map.n() ; n++)
644  {
646  if (type != uff_none)
647  {
648  const char *d = EST_UtteranceFile::map.info(type).description;
649  for(int ni=0; ni<NAMED_ENUM_MAX_SYNONYMS; ni++)
650  {
651  const char *nm = EST_UtteranceFile::map.name(type, ni);
652  if (nm==NULL)
653  break;
654 
655  s += EST_String::cat(" ", nm, EST_String(" ")*(12-strlen((nm))), (d?d:"NULL"), "\n");
656  }
657  }
658  }
659  return s;
660 }
661 
662 
663 
664 // note the order here defines the order in which loads are tried.
665 Start_TNamedEnumI_T(EST_UtteranceFileType, EST_UtteranceFile::Info, EST_UtteranceFile::map, utterancefile)
666  { uff_none, { NULL },
667  { FALSE, NULL, NULL, "unknown utterance file type"} },
668  { uff_est, { "est", "est_ascii"},
669  { TRUE, EST_UtteranceFile::load_est_ascii, EST_UtteranceFile::save_est_ascii, "Standard EST Utterance File" } },
670 #if defined(INCLUDE_XML_FORMATS)
671  { uff_apml, { "apml", "xml"},
672  { TRUE, EST_UtteranceFile::load_apml, NULL, "Utterance in APML" } },
673  { uff_genxml, { "genxml", "xml"},
674  { TRUE, EST_UtteranceFile::load_genxml, EST_UtteranceFile::save_genxml, "Utterance in XML, Any DTD" } },
675 #endif
676  { uff_xlabel, { "xlabel"},
678  { uff_none, {NULL},
679  { FALSE, NULL, NULL, "unknown utterance file type"} }
680 
681 End_TNamedEnumI_T(EST_UtteranceFileType, EST_UtteranceFile::Info, EST_UtteranceFile::map, utterancefile)
682 
683 Declare_TNamedEnumI(EST_UtteranceFileType, EST_UtteranceFile::Info)
684 
685 #if defined(INSTANTIATE_TEMPLATES)
686 #include "../base_class/EST_TNamedEnum.cc"
687 Instantiate_TNamedEnumI(EST_UtteranceFileType, EST_UtteranceFile::Info)
688 #endif
689 
690 Declare_TVector_Base_T(EST_Item_Content *, NULL, NULL, EST_Item_ContentP)
691 
692 #if defined(INSTANTIATE_TEMPLATES)
693 
694 #include "../base_class/EST_TSimpleVector.cc"
695 #include "../base_class/EST_TVector.cc"
696 #include "../base_class/EST_Tvectlist.cc"
697 
698 Instantiate_TVector_T(EST_Item_Content *, EST_Item_ContentP)
699 
700 #endif
701 
EST_Item * head() const
Definition: EST_Relation.h:121
EST_TokenStream & get(EST_Token &t)
get next token in stream
Definition: EST_Token.cc:499
static EST_write_status save_genxml(SaveUtterance_TokenStreamArgs)
EST_read_status apml_read(FILE *file, const EST_String &name, EST_Utterance &u, int &max_id)
Definition: apml.cc:124
FILE * filedescriptor()
For the people who need the actual description (if possible)
Definition: EST_Token.h:380
const char * description
EST_FilePos EST_ftell(FILE *fp)
Definition: EST_File.h:71
EST_write_status
static EST_read_status read_xml(FILE *file, const EST_String &name, EST_Utterance &u, int &max_id)
Definition: genxml.cc:188
void clear()
remove everything in utterance
The file was read in successfully.
EST_Relation * create_relation(const EST_String &relname)
create a new relation called n.
void set_val(const EST_String &name, const EST_Val &sval)
Definition: EST_Features.h:217
void set(const EST_String &name, ssize_t ival)
Definition: EST_Item.h:185
int ival(const EST_String &rkey, int m=1) const
Definition: EST_Option.cc:82
EST_Val est_val(const EST_Item_featfunc f)
Definition: item_feats.cc:122
static EST_String options_short(void)
EST_EstFileType
Definition: EST_FileType.h:50
void set_SingleCharSymbols(const EST_String &sc)
set which characters are to be treated as single character symbols
Definition: EST_Token.h:344
const EST_String filename() const
The originating filename (if there is one)
Definition: EST_Token.h:378
EST_read_status load(EST_TokenStream &ts)
load features from already opened EST_TokenStream
A specialised hash table for when the key is an EST_String.
Definition: EST_THash.h:304
int ssize_t
#define Instantiate_TVector_T(TYPE, TAG)
Definition: EST_TVectorI.h:52
EST_Features f
Utterance level features.
EST_Features relations
The list of named relations.
static EST_read_status load_est_ascii(LoadUtterance_TokenStreamArgs)
EST_Features f
General features for this item.
#define NAMED_ENUM_MAX_SYNONYMS
static EST_String cat(const EST_String s1, const EST_String s2=Empty, const EST_String s3=Empty, const EST_String s4=Empty, const EST_String s5=Empty, const EST_String s6=Empty, const EST_String s7=Empty, const EST_String s8=Empty, const EST_String s9=Empty)
Definition: EST_String.cc:1084
static EST_TNamedEnumI< EST_UtteranceFileType, Info > map
void set_utt(EST_Utterance *u)
Definition: EST_Relation.h:115
static EST_read_status load_xlabel(LoadUtterance_TokenStreamArgs)
An error occurred while reading.
EST_TKVL< EST_String, EST_Val > relations
EST_Item * up() const
Definition: EST_Item.h:354
The file was not written successfully.
int eof()
end of file
Definition: EST_Token.h:362
void resize(ssize_t n, int set=1)
Definition: EST_TVector.cc:196
ENUM nth_token(int n) const
const char * name(ENUM tok, int n=0) const
INLINE ssize_t length() const
number of items in vector.
Definition: EST_TVector.h:249
const EST_String & name() const
Definition: EST_Relation.h:118
float F(const EST_String &name) const
Definition: EST_Item.h:135
int n(void) const
The file was written successfully.
#define Declare_TNamedEnumI(ENUM, INFO)
EST_Item_Content * contents() const
Definition: EST_Item.h:244
A valid file was created, but only some of the requested data is in there.
#define FALSE
Definition: EST_bool.h:119
EST_read_status read_est_header(EST_TokenStream &ts, EST_Option &hinfo, bool &ascii, EST_EstFileType &t)
Definition: est_file.cc:143
#define misc_read_error
The file exists but is not in the format specified.
NULL
Definition: EST_WFST.cc:55
Templated Key-Value list. Objects of type EST_TKVL contain lists which are accessed by a key of type ...
Definition: EST_TKVL.h:73
#define EST_error
Definition: EST_error.h:104
f
Definition: EST_item_aux.cc:48
int EST_fseek(FILE *fp, EST_FilePos offset, int whence)
Definition: EST_File.h:75
#define Instantiate_TNamedEnumI(ENUM, INFO)
EST_Item * down() const
Definition: EST_Item.h:352
EST_Token & peek(void)
peek at next token
Definition: EST_Token.h:332
static EST_read_status load_apml(LoadUtterance_TokenStreamArgs)
EST_Features & features() const
Definition: EST_Item.h:258
static EST_write_status save_est_ascii(SaveUtterance_TokenStreamArgs)
EST_write_status save(ostream &outf) const
save features in already opened ostream
void set_quotes(char q, char e)
set characters to be used as quotes and escape, and set quote mode
Definition: EST_Token.h:353
The file was not written successfully.
#define Declare_TVector_Base_T(TYPE, DEFAULT, ERROR, TAG)
Definition: EST_TVectorI.h:64
int add_item(const EST_String &key, const V &value, int no_search=0)
Add an entry to the table.
EST_Item * next() const
Definition: EST_Item.h:348
int add_item(const K &rkey, const V &rval, int no_search=0)
add key-val pair to list
Definition: EST_TKVL.cc:248
Start_TNamedEnumI_T(EST_UtteranceFileType, EST_UtteranceFile::Info, EST_UtteranceFile::map, utterancefile)
EST_read_status
INFO & info(ENUM token) const
EST_UtteranceFileType
void begin(const Container &over)
Set the iterator ready to run over this container.
#define EST_warning
Definition: EST_error.h:106
Template vector.
Definition: EST_TVector.h:145
#define format_ok
const EST_String pos_description()
A string describing current position, suitable for error messages.
Definition: EST_Token.cc:882
int present(const K &rkey) const
Returns true if key is present.
Definition: EST_TKVL.cc:222
#define End_TNamedEnumI_T(ENUM, INFO, NAME, TAG)
EST_write_status save(const EST_String &filename, bool evaluate_ff=false) const
int I(const EST_String &path) const
Definition: EST_Features.h:147
EST_read_status load(const EST_String &filename, const EST_String &type="esps")
LISP fp
Definition: kkcompile.cc:63
static EST_read_status load_genxml(LoadUtterance_TokenStreamArgs)
EST_String
#define TRUE
Definition: EST_bool.h:118
off_t EST_FilePos
Definition: EST_File.h:69
static EST_String options_supported(void)
static EST_write_status save_xlabel(SaveUtterance_TokenStreamArgs)
int unref_relation(const EST_String &relname)
Utility EST_String Functions header file.