Experimental code for generating English from logic expressions Last revised: 2019-07-08 For an introduction, see Flickinger (2017): ``Generating English Paraphrases from Logic,'' in Martijn Wieling, Gosse Bouma and Gertjan van Noord, eds., "From Semantics to Dialectometry". Springer. ------------------------------------------------------------------------------ Running the generator --------------------- To run the precompiled generator from the command line, connect to the openproof directory, and then execute the `runfol' script as in the following example, with the required -f argument and three optional ones: -f -r -x -a ./runfol -f "small(a)-->large(b)" -r rules.all -x no.optthen -a req.dropthen > /tmp/out.txt; more /tmp/out.txt Several predefined rule sets are provided in files named "rules.*", where the rules are grouped by broad linguistic phenomena such as ellipsis, pronominal anaphora, and aggregation (coordination). Sets of rule groups to exclude are also defined in files named "no.*", for fine-tuning of the output. A list of individual rules to use beyond the predefined sets can be supplied with the "-a" option. Brief explanations for the full list of available rules are given in the fule "ruledefs.txt". The precompiled system consists of three grammar files: inflate.dat Conversion from FOL expressions to MRSs paraphrase-op.dat Maps MRSs to paraphrase MRSs ergopen.dat Generates English sentences from paraphrase MRSs In addition, the `scripts' subdirectory contains the Python files used in the initial conversion of an FOL into a pseudo-MRS format suitable for input to the inflate.dat grammar. ------------------------------------------------------------------------------ Compiling the grammars ---------------------- The following instructions outline how to compile a version of the paraphrase grammar, then call Aaron Kalb's FOL converter to MRS syntax, then inflate to a full generator-ready MRS, add paraphrased MRSs, generate, sort the realized outputs uniquely, and write to a file. 1. Compile the MRS-inflation, paraphrase, and generator grammars cd ~/erg ace -G openproof/inflatemrs.dat -g openproof/config-inflate.tdl ace -G openproof/paraphrase-op.dat -g openproof/config.tdl ace -G openproof/ergopen.dat -g ace/config-open.tdl 2. To run single examples interactively, call `runfol' with at least the first two arguments (an FOL expression and a set of paraphrase rules to apply). Direct the output in XML to a file `out.txt'. cd ~/erg/openproof; ./runfol -f "small(a)-->large(b)" -r rules.all > /tmp/out.txt 3. For batch generation on all formulae in `fols.txt': cd ~/erg; for i in $(cat openproof/fols.txt); do \python openproof/scripts/e2e.py $i | ace-op -g inflatemrs.dat -f | ace-op -g paraphrase-op.dat -f | ace-op -g ergopen.dat -e | sort -u; echo "---ITEM---"; done > /tmp/out.txt The mechanism for constraining which paraphrase rules get used is as follows: - The config-*.tdl files determine which paraphrase-op-*.tdl file gets loaded, and these files in turn specify which mtr-op-*.tdl file gets loaded. - The runfol-* files are the executable scripts that can be called by the top-level server.py script (in lingo/openproof/Server), and each of these runfol-* files starts by compiling the relevant set of paraphrase rules, by invoking the appropriate config-*.tdl file.