Writing DRC Batch Files

The DRC simulation software is capable of running simulations of a single stimulus using the command-line, for example:

drc -a tree 1000

Using the -b command line option, however, allows large lists of stimuli to be simulated. In DRC parlance such lists are called batch files. This document describes how to create DRC batch files, and how to make use of special features of DRC's batch file parser.

A DRC batch file is simply a text file, that can be created using common text file editing programs, such as TextEdit on Mac OS X, emacs, vim, or one of the countless other text editors available on Linux, or Notepad in Windows. Once such a file has been created, DRC can be instructed to use it with the -b command line option. For example:

drc -b batchfile.txt 1000

The DRC batch file parser processes batch files one line at a time. Lines can take one of three forms: a comment line, a stimulus line or a batch command line.

Comment Lines

Any line beginning with the # character is considered to be a comment and is completely ignored by the parser. Comments provide a way to document a batch file so that it can be easily understood by other people. Empty lines are also ignored by the parser, which allows batch files to be spaced to create a more readable layout.

Stimulus Lines

Any non-empty line that does not begin with either a # character or a ! character is considered to be a stimulus line. DRC will run a simulation of each such stimulus presented. A stimulus line has the following format:

[Max-Cycles] Stimulus [Comments/Categories]

The first field, Max-Cycles, is optional. Max-Cycles specifies the maximum number of cycles for which the stimulus should be simulated. If the field is not present the default maximum, or the maximum specified on the command-line when the simulation was started, will be used instead.

The last field, Comments/Categories, is also optional. If it is present it will be repeated at the end of the result line in the RT file for the stimulus. It will also be treated as a space-separated list of categories to which the stimulus belongs. Statistics are generated for all such categories encountered and stored in the ".stats" output file.

Batch Command Lines

Any line beginning with the ! character is considered to be a batch command line. Batch commands allow changes to be made to the way the model behaves. The following batch commands are available:

QUIT

The QUIT command instructs DRC to stop immediately. No further stimuli in the batch file will be processed, and parameter stepping will also be halted.

AUTORESET

During normal batch file processing, the model will be reset after each stimulus. All activation levels will be set to zero, the input will be cleared, and so forth. This behaviour can be disabled using the AUTORESET command, as follows:

! AUTORESET OFF

Re-enabling the automatic resetting of the model is accomplished in a similar way:

! AUTORESET ON

Note: When the automatic resetting behaviour is disabled, all activity in the model will be reported to one ".acts" file (usually named for the first stimulus presented after the AUTORESET OFF command). This will continue until the model is reset, either manually or by re-enabling the automatic reset.


RESET

When the automatic resetting of the model after each stimulus has been disabled using the AUTORESET command, the model can be manually reset using the RESET command as follows:

! RESET
Parameter Changing

Parameter values can be changed during batch file processing by specifying the parameter name followed by a value. The following example will cause the LetterOrthlexExcitation parameter to be set to the value 0.12:

! LetterOrthlexExcitation 0.12

If value is omitted, or the word default is given in place of the value, then the parameter will be set to its default value (which is dependant on the language in use).

Note: The parameter will remain at the new value for the rest of the DRC job (or until another batch command changes it again). Care should be taken when using this command in combination with the parameter-stepping feature of DRC since the new value for the parameter will carry over when the batch file is restarted on subsequent parameter-steps.


DECAY

The DECAY command can be used to cause the model to run a number of cycles in which only decay occurs.

Note: Apart from the decay, no inter- or intra-layer interaction occurs during DECAY cycles.


The format for the DECAY command is as follows:

! DECAY num-cycles [New decay parameter values]

The num-cycles field is mandatory. It specifies the number of DECAY cycles that should be run. The new decay parameter values can be specified in one of three ways.

1. It can be omitted entirely, in which case no changes will be made to the decay parameters.
2. One value can be provided, in which case the LetterDecay, OrthlexDecay, PhonlexDecay and PhonemeDecay parameters will all be set to that value for the duration of the DECAY.
3. Four values can be provided, in which case the four values specify the values that the LetterDecay, OrthlexDecay, PhonlexDecay and PhonemeDecay respectively will take on for the duration of the DECAY.

NOINPUT

The NOINPUT command can be used to run a number of cycles in the model with the input cleared - that is, all the visual features are turned off. The format for NOINPUT is identical to that of DECAY:

! NOINPUT num-cycles [New decay parameter values]

Note: The difference between NOINPUT and DECAY is that during NOINPUT cycles, all normal inter- and intra-layer interaction continues.


PRIME

The PRIME command is provided as a simpler way of doing priming.

The complicated way to do priming is as follows:

! AUTORESET OFF
24 prime1
target1
!RESET
12 prime2
target2
!RESET

With the PRIME command, the same thing can be achieved more simply:

! PRIME 24 prime1
target1
! PRIME 12 prime2
target2

Note: When the PRIME command is used the name chosen for the ".acts" file will be based on the target stimulus, unless automatic resetting of the model has been disabled with the "AUTORESET OFF" command.


A DECAY or NOINPUT command can be combined with a PRIME command, as in the following examples:

! PRIME 24 prime1 THEN DECAY 1 1.0 0.0 0.0 0.0
! PRIME 24 prime1 THEN NOINPUT 1 1.0

This will have the effect of running the DECAY or NOINPUT command after the PRIME command has been completed, but before simulation of the target is started.

An Example Batch File

The following is an example batch file that uses many of the features described above.

##############################################################################
# Example DRC Batch File
##############################################################################

##############################################################################
# Section 1. Normal Stimuli Simulations. 
# In this section, 3 simulations are run for 3 different stimuli.
# i.   TREE will run until named, or the default maximum number of cycles
#      is reached. It is in the category 'words'
# ii.  SPLIFF will run for a maximum of 200 cycles, or until named (unless
#      the '-c' command line option was used.) It is in the category 'nonwords'
# iii. CAKE will run for a maximum of only 10 cycles. It is not in any
#      category.
##############################################################################
tree words
200 spliff nonwords
10 cake

##############################################################################
# Section 2. Batch Commands
# In this section, automatic reset is disabled, then the stimulus TREE is
# run for 20 cycles, then, without the activation levels in the model being
# reset, CAKE is run until named.
# The model is then reset, and SPLIFF is run for 30 cycles, then activation
# levels in the letter layer are decayed by 50%, and then tree is run until
# named.
# Finally, the automatic reseting of the model after each stimulus is 
# re-enabled.
##############################################################################
! AUTORESET OFF
20 tree
cake
! RESET
30 spliff
! DECAY 1 0.5 0.0 0.0 0.0
tree
! RESET
! AUTORESET ON

##############################################################################
# Section 3. The PRIME Command
# In this section, the same things done in section 2 are achieved using the
# prime command.
##############################################################################
! PRIME 20 tree
cake
! PRIME 30 spliff THEN DECAY 1 0.5 0.0 0.0 0.0
tree

MACCS > DRC > Writing DRC Batch Files