45 #include "EST_simplestats.h"
49 void wfst_train(
EST_WFST &wfst, LISP data);
51 static int wfst_train_main(
int argc,
char **argv);
53 int main(
int argc,
char **argv)
56 wfst_train_main(argc,argv);
62 static int wfst_train_main(
int argc,
char **argv)
72 EST_String(
"[WFSTFILE] [input file0] ... [-o output file]\n")+
73 "Summary: Train a WFST on data\n"+
74 "-wfst <ifile> The WFST to start from\n"+
75 "-data <ifile> Sentences in the language recognised by WFST\n"+
76 "-o <ofile> Output file for trained WFST\n"+
77 "-heap <int> {210000}\n"+
78 " Set size of Lisp heap, needed for large rulesets\n",
83 if ((ofd=fopen(al.
val(
"-o"),
"w")) == NULL)
84 EST_error(
"can't open output file for writing \"%s\"",
85 (
const char *)al.
val(
"-o"));
91 wfstfile = al.
val(
"-wfst");
93 EST_error(
"no WFST specified");
95 siod_init(al.
ival(
"-heap"));
101 if (wfst.
load(wfstfile) != format_ok)
102 EST_error(
"failed to read WFST from \"%s\"",
103 (
const char *)wfstfile);
105 data = load_string_data(wfst,al.
val(
"-data"));
107 wfst_train(wfst,data);
109 if (wfst.
save(al.
val(
"-o")) != write_ok)
110 EST_error(
"failed to write trained WFST to \"%s\"",
111 (
const char *)al.
val(
"-o"));
a call representing a weighted finite-state transducer
int ival(const EST_String &rkey, int m=1) const
EST_write_status save(const EST_String &filename, const EST_String type="ascii")
?
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_read_status load(const EST_String &filename)
?