53 static int scfg_test_main(
int argc,
char **argv);
57 int main(
int argc,
char **argv)
60 scfg_test_main(argc,argv);
66 static int scfg_test_main(
int argc,
char **argv)
75 "Summary: Test a stochastic context free grammar against a corpus\n"+
76 "-grammar <ifile> Grammar file, one rule per line.\n"+
77 "-corpus <ifile> Single Corpus file, one bracketed sentence per line.\n"+
78 "-crossbrackets Measure cross bracket performance.\n"+
79 "-heap <int> {210000}\n"+
80 " Set size of Lisp heap, needed for large corpora\n"+
81 "-o <ofile> Output file for parsed sentences.\n",
85 outfile = al.
val(
"-o");
89 siod_init(al.
ival(
"-heap"));
95 grammar.
load(al.
val(
"-grammar"));
99 cerr <<
"scfg_test: no grammar specified" << endl;
105 grammar.load_corpus(al.
val(
"-corpus"));
109 cerr <<
"scfg_test: no corpus specified" << endl;
114 if (al.
present(
"-crossbrackets"))
115 grammar.test_crossbrackets();
117 grammar.test_corpus();
EST_read_status load(const EST_String &filename)
Load grammar from named file.
A class used to train (and test) SCFGs is an extension of EST_SCFG .
int ival(const EST_String &rkey, int m=1) const
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)