53 static int scfg_test_main(
int argc,
char **argv);
89 int main(
int argc,
char **argv)
92 scfg_test_main(argc,argv);
98 static int scfg_test_main(
int argc,
char **argv)
107 "Summary: Test a stochastic context free grammar against a corpus\n"+
108 "-grammar <ifile> Grammar file, one rule per line.\n"+
109 "-corpus <ifile> Single Corpus file, one bracketed sentence per line.\n"+
110 "-crossbrackets Measure cross bracket performance.\n"+
111 "-heap <int> {210000}\n"+
112 " Set size of Lisp heap, needed for large corpora\n"+
113 "-o <ofile> Output file for parsed sentences.\n",
117 outfile = al.
val(
"-o");
121 siod_init(al.
ival(
"-heap"));
127 grammar.
load(al.
val(
"-grammar"));
131 cerr <<
"scfg_test: no grammar specified" << endl;
137 grammar.load_corpus(al.
val(
"-corpus"));
141 cerr <<
"scfg_test: no corpus specified" << endl;
146 if (al.
present(
"-crossbrackets"))
147 grammar.test_crossbrackets();
149 grammar.test_corpus();
EST_read_status load(const EST_String &filename)
Load grammar from named file.
const int present(const K &rkey) const
Returns true if key is present.
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)