Special Batch Jobs

Miscellaneous: Scripting

  1. Batch Jobs:

    Creating and running .xpl files.

  2. Special Batch Jobs:

    For verification and comparisons.

  3. Scripting:

    How to create automatic scripts.


Contents

Script Files
Scripting Language
Run Class
run_selection
time_selection
run_file
Language Class
load
compile
Theory Class
Parsers Class History Class Options Class
Display Class Demo Class


Script Files

PAPPI has a simple scripting facility that allow the user to supply a file containing a sequence of commands. By convention, script files will have the .dbf suffix. When loaded, PAPPI will automatically run through the script, executing commands as if typed or selected through the graphical user interface. For example, sentences can be parsed, resulting parses can be annotated with Post-It-style notes, filters switched on or off, or different lexicons loaded.

The following snippet illustrates some of the possible actions. It is produced by the supplied French language demo file Fre.dbf:

Here the script file tries to parse the ungrammatical sentence Marie croit Pierre être heureux. PAPPI reports the sentence is blocked by the Case Filter. The Case Filter is switched off and the offending sentence reparsed. The resulting parse tree is annotated with a detailed explanation of why the sentence is ungrammatical. Finally, the Case Filter is reactivated.

To start (and stop) the execution of a script file, use the Start (and Stop) Script command, available from the Run Menu as shown below:

(a) Start Script (b) Stop Script

Clicking on Start Script, as in (a) above, will bring up a file dialog box listing the .dbf files in the current directory, as shown below. Double-clicking on the file name will initiate execution of the script:

Script File Dialog


Scripting Language

Each command begins with a ! and occupies a single line in the script file. The format is as follows:
!Class Command Parameters
Scripting commands are divided into classes according to the main Menu Bar:

For example, to clear the history, we have the following scripting command implementing the corresponding user interface button:

!history clear

The following subsections will describe commands in each of the classes in turn. Finally, there are also special commands for display. These will be covered at the end of the section.


Run Class

run_selection +S Runs sentence S.

Example:

!run run_selection    "[3c]   Pierre aime le livre que Marie a acheté."
Note the sentence must be double-quoted. Consult the reference below for additional input sentence format details.

Reference: Input Window


time_selection +S Runs sentence S and reports the time taken.

Operates just like run_selection.

Example:

!run time_selection "John likes Mary"

Reference: run_selection


run_file +File Runs batch file File.

Note: batch files only. A script file cannot call another script file.

Example:

!run run_batch "l&u.xpl"
Runs the supplied Lasnik & Uriagereka sentences.

Reference: Batch Jobs


Language Class

load +Lang Loads language files for language Lang.

Example:

!language load Kor
will load the language files associated with the suffix Kor, namely:

lexiconKor.pl parametersKor.pl peripheryKor.pl
transitionKor.pl actionKor.pl igoalsKor.pl commentsKor.pl

Note: PAPPI will actually load the compiled (.qof) versions of these files. Files will be automatically compiled first if necessary.


compile +Lang Compiles source language files for language Lang.

Example:

!language compile Eng
will compile the source language files associated with the suffix Eng, namely:

lexiconEng.pl parametersEng.pl peripheryEng.pl
transitionEng.pl actionEng.pl igoalsEng.pl commentsEng.pl

Note: the files are compiled to disk. They are not loaded into PAPPI.

Reference: language load


Theory Class


Parsers Class


History Class


Options Class


Display Class


Demo Class

Special Batch Jobs