54 static int scfg_parse_main(
int argc,
char **argv);
57 int main(
int argc,
char **argv)
60 scfg_parse_main(argc,argv);
66 static int scfg_parse_main(
int argc,
char **argv)
79 "Summary: Parse a corpus with a stochastic context free grammar\n"+
80 "-grammar <ifile> Grammar file, one rule per line.\n"+
81 "-corpus <ifile> Corpus file, one bracketed sentence per line.\n"+
82 "-brackets Output bracketing only.\n"+
83 "-o <ofile> Output file for parsed sentences.\n",
87 outfile = al.
val(
"-o");
100 cerr <<
"scfg_parse: no grammar specified" << endl;
106 if ((corpus = fopen(al.
val(
"-corpus"),
"r")) ==
NULL)
108 cerr <<
"scfg_parse: can't open corpus file \"" <<
109 al.
val(
"-corpus") <<
"\" for reading " << endl;
115 cerr <<
"scfg_parse: no corpus specified" << endl;
121 if ((output=fopen(al.
val(
"-o"),
"w")) ==
NULL)
123 cerr <<
"scfg_parse: can't open output file \"" <<
124 al.
val(
"-o") <<
"\" for writing " << endl;
149 if (output != stdout)
void gc_unprotect(LISP *location)
LISP scfg_bracketing_only(LISP parse)
LISP vload(const char *fname, long cflag)
const V & val(const K &rkey, bool m=0) const
return value according to key (const)
void pprint_to_fd(FILE *fd, LISP exp)
A class for parsing with a probabilistic grammars.
int main(int argc, char **argv)
int present(const K &rkey) const
Returns true if key is present.
void gc_protect(LISP *location)
int siod_init(int heap_size=DEFAULT_HEAP_SIZE)
void scfg_parse(EST_Relation *Word, const EST_String &name, EST_Relation *Syntax, EST_SCFG &grammar)
int parse_command_line(int argc, char *argv[], const EST_String &usage, EST_StrList &files, EST_Option &al, int make_stdio=1)