Contents of this chapter:

What are definition files for?
definition file example
query file example
recursive definitions
output file example

What are definition files for?

Definition files are an optional convenience for the CorpusSearch user. If you find yourself writing the same long argument list for many different queries, you would probably benefit from having a definition file. A definition file allows you to assign a label to a list of arguments. When you write a query, you can refer to this label instead of writing out the argument list.

definition file example

Here's an example of a definition file written by Ann Taylor. The name of the file is "Ann.def". Definition file names must always have the extension .def.

// definition file written by Ann Taylor.

non_finite_verb:  *VB|V*N|*HV|H*N|*DO|D*N|*BE|BEN

finite_verb:  *MD|*HVP|*HVD|*DOP|*DOD|*BEP|*BED|*VBP|*VBD

query file example

Here's an example of a query file that refers to the definition file:

define: Ann.def

query:  (finite_verb precedes non_finite_verb)

The first line, "define: Ann.def", tells CorpusSearch where to find the definitions of "finite_verb" and "non_finite_verb". Without this line, "finite_verb" and "non_finite_verb" will not be replaced by their definitions.

recursive definitions

Terms may be defined recursively, that is, one term may be a list of other terms. To make a recursive reference use the dollar sign "$". Here's an example of a recursive definition file:

first:  there's|a|somebody|I'm
second: longing|to|see
third: I|hope|that|he
fourth: turns|out|to|be
fifth: someone|to|watch|over|me

first2: $first|$second
next3: $third|$fourth|$fifth

whole: $first2|$next3

Notice that the one term "whole" refers to the entire stanza.

output file example

Here's the preface from an output file resulting from "def.q".

/*
    PREFACE:
    CorpusSearch copyright Beth Randall 2000.
    Date:  Thu Apr 13 08:57:07 EDT 2000

    command file:       def.q
    output file:        def.out

    definition file:  Ann.def
    node:   IP*
    query:  (*MD|*HVP|*DOP|*DOD|*BEP|*BED|*VBP|*VBD precedes
             *VB|V*N|*HV|H*N|*DO|D*N|*BE|BEN)
*/

Notice that the query appears in two forms: first in the shorthand form found in the command file, and second in its expanded form after the installation of the definitions. The second form of the query is the one that CorpusSearch uses for the search. If you still see your definition labels in the second form of the query, it means that the definitions were not installed. You may have forgotten to put "define: <def.file>" in your command file, or perhaps misspelled the labels.