41 #include "EST_ling_class.h"
42 #include "EST_Track.h"
43 #include "EST_cmd_line.h"
48 int main(
int argc,
char *argv[])
59 EST_String(
" [input file1] [input file2] -o [output file]\n") +
60 "Summary: change/copy label files\n"+
61 "use \"-\" to make input and output files stdin/out\n"+
63 "-S <float> frame spacing of output\n"+
64 "-base use base filenames for lists of label files\n"+
65 "-class <string> Name of class defined in op file\n"+
68 "-end <float> end time (secs) for label extraction\n"+
69 "-ext <string> filename extension\n"+
70 "-extend <float> extend track file beyond label file\n"+
71 "-extract <string> extract a single file from a list of label files\n"+
72 "-f <int> sample frequency of label file\n"+
73 "-itype <string> type of input label file: esps htk ogi\n"+
74 "-key <string> key label file\n"+
75 "-lablist <string> list of labels to be considered as blank\n"+
76 "-length <float> length of track produced\n"+
77 "-lf <int> sample frequency for labels\n"+
78 "-map <string> name of file containing label mapping\n"+
79 "-name <string> eg. Fo Phoneme\n"+
80 "-nopath ignore pathnames when searching label lists\n"+
81 "-o <ofile> output gile name\n"+
82 "-off <float> vertical offset of track\n"+
83 "-ops print options\n"+
84 "-otype <string> {esps}\n"+
85 " output file type: xmg, ascii, esps, htk\n"+
86 "-pad <string> Pad with \"high\" or \"low\" values\n"+
87 "-pos <string> list of labels to be regarded as 'pos'\n"+
88 "-q <float> quantize label timings to nearest value\n"+
89 "-range <float> different between high and low values\n"+
90 "-sed <ifile> perform regex editing using sed file\n"+
91 "-shift <float> shift the times of the labels\n"+
92 "-start <float> start time for label extraction\n"+
93 "-style <string> output stype e.g. track\n"+
94 "-vocab <ifile> file containing list of words in vocab\n"+
95 "-verify check that only labels in vocab file are in label file\n",
102 read_RelationList(mlf, files, al);
105 for (p = mlf.head(); p; p = p->next())
106 relation_convert(mlf(p), al, op);
113 cerr <<
"Couldn't read vocab file " << al.
val(
"-vocab")
114 <<
" for verification\n";
117 for (p = mlf.head(); p; p = p->next())
118 check_vocab(mlf(p), vocab);
122 if (files.length() == 1)
126 lab = RelationList_extract(mlf, al.
val(
"-extract"),
134 lab = RelationList_combine(mlf, key);
137 lab = RelationList_combine(mlf);
147 if (relation_divide(mlf, lab, key, blank, ext) == -1)
153 if (al.
val(
"-style", 0) ==
"track")
156 label_to_track(lab, al, op, tr);
157 tr.
save(out_file, op.
val(
"track_file_type", 0));
161 int path = al.
present(
"-nopath") ? 0 : 1;
162 if (al.
val(
"-otype", 0) ==
"mlf")
163 save_RelationList(out_file, mlf, 1, path);
164 else if (al.
val(
"-otype", 0) ==
"wmlf")
165 save_RelationList(out_file, mlf, 0, path);
166 else if (al.
val(
"-otype", 0) ==
"words")
167 save_WordList(out_file, mlf, 0);
168 else if (al.
val(
"-otype", 0) ==
"sentence")
169 save_WordList(out_file, mlf, 1);
170 else if (al.
val(
"-otype", 0) ==
"ind")
173 save_ind_RelationList(out_file, mlf,
"Addresses", path);
175 save_ind_RelationList(out_file, mlf,
"None", path);
179 lab.
save(out_file,al.
val(
"-otype"));
192 if (al.
val(
"-style", 0) ==
"track")
int override_val(const EST_String rkey, const EST_String rval)
add to end of list or overwrite. If rval is empty, do nothing
void StringtoStrList(EST_String s, EST_StrList &l, EST_String sep)
Convert a EST_String to a EST_StrList by separating tokens in s delimited by the separator sep...
EST_write_status save(const EST_String name, const EST_String EST_filetype="")
const T & first() const
return const reference to first item in list
const int present(const K &rkey) const
Returns true if key is present.
const V & val(const K &rkey, bool m=0) const
return value according to key (const)
EST_write_status save(const EST_String &filename, bool evaluate_ff=false) const
EST_read_status load(const EST_String &filename, const EST_String &type="esps")
EST_read_status load_StrList(EST_String filename, EST_StrList &l)
Load tokens from a file and return them in a EST_StrList.
Utility EST_String Functions header file.