45 #include "EST_simplestats.h"
49 void wfst_train(
EST_WFST &wfst, LISP data);
51 static int wfst_train_main(
int argc,
char **argv);
84 int main(
int argc,
char **argv)
87 wfst_train_main(argc,argv);
93 static int wfst_train_main(
int argc,
char **argv)
103 EST_String(
"[WFSTFILE] [input file0] ... [-o output file]\n")+
104 "Summary: Train a WFST on data\n"+
105 "-wfst <ifile> The WFST to start from\n"+
106 "-data <ifile> Sentences in the language recognised by WFST\n"+
107 "-o <ofile> Output file for trained WFST\n"+
108 "-heap <int> {210000}\n"+
109 " Set size of Lisp heap, needed for large rulesets\n",
114 if ((ofd=fopen(al.
val(
"-o"),
"w")) == NULL)
115 EST_error(
"can't open output file for writing \"%s\"",
116 (
const char *)al.
val(
"-o"));
122 wfstfile = al.
val(
"-wfst");
124 EST_error(
"no WFST specified");
126 siod_init(al.
ival(
"-heap"));
132 if (wfst.
load(wfstfile) != format_ok)
133 EST_error(
"failed to read WFST from \"%s\"",
134 (
const char *)wfstfile);
136 data = load_string_data(wfst,al.
val(
"-data"));
138 wfst_train(wfst,data);
140 if (wfst.
save(al.
val(
"-o")) != write_ok)
141 EST_error(
"failed to write trained WFST to \"%s\"",
142 (
const char *)al.
val(
"-o"));
int ival(const EST_String &rkey, int m=1) const
const V & val(const K &rkey, bool m=0) const
return value according to key (const)
const int present(const K &rkey) const
Returns true if key is present.
EST_write_status save(const EST_String &filename, const EST_String type="ascii")
?
EST_read_status load(const EST_String &filename)
?