## gate.jape
Class Batch

    java.lang.Object
      |
      +--gate.jape.Batch

All Implemented Interfaces:
  JapeConstants, Serializable

public class Batch
extends Object
implements JapeConstants

Batch processing of JAPE transducers against documents or collections. Construction will parse or deserialise a transducer as required.

See Also:
  Serialized Form

Field Summary
`private static boolean` `DEBUG` Debug flag
`private String` `encoding` The encoding used for reading the grammar file(s)
`private FeatureMap` `features` Path to the resources tree
`private URL` `japeURL` The URL that points to a .jape file
`private Vector` `progressListeners`
`private Vector` `statusListeners`
`private Transducer` `transducer` The JAPE transducer.
`private boolean` `verbose` Whether to print progress messages or not.

Fields inherited from interface gate.jape.JapeConstants
`APPELT_STYLE, BRILL_STYLE, DEFAULT_PRIORITY, FIRST_STYLE, INDENT_PADDING, KLEENE_PLUS, KLEENE_QUERY, KLEENE_STAR, MULTI_SPAN_BINDING, NO_BINDING, NO_KLEENE_OP, SINGLE_SPAN_BINDING`

Constructor Summary
`private` `Batch()` Create non-initialised instance (private, used in main).
`` `Batch(URL url, String encoding)` Create a fully initialised instance.
`` `Batch(URL url, String encoding, StatusListener sListener)`

Method Summary
`void` `addProgressListener(ProgressListener l)`
`void` `addStatusListener(StatusListener l)`
`protected void` `fireProcessFinished()`
`protected void` `fireProgressChanged(int e)`
`protected void` `fireStatusChanged(String e)`
`FeatureMap` `getFeatures()`
`Transducer` `getTransducer()` Get the transducer.
`void` `interrupt()` Notifies this PR that it should stop its execution as soon as possible.
`static void` `main(String[] args)` This is where it all happens.
`void` `message(String mess)` Hello? Anybody there??
`private void` `parseJape()` Parse a jape file from `japeURL` and store the transducer.
`void` `removeProgressListener(ProgressListener l)`
`void` `removeStatusListener(StatusListener l)`
`void` `setFeatures(FeatureMap newFeatures)`
`void` `setVerbose(boolean turtleSoup)` Set verbosity.
`void` `transduce(Corpus coll)` Process the given collection.
`void` `transduce(Document doc)` Process a single document.
`void` `transduce(Document doc, AnnotationSet inputAS, AnnotationSet outputAS)` Process a single document.
`void` `usage(String errorMessage)` You got something wrong, dumbo.

Methods inherited from class java.lang.Object
`<clinit>, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### DEBUG

    private static final boolean DEBUG

  Debug flag

### japeURL

    private URL japeURL

  The URL that points to a .jape file

### encoding

    private String encoding

  The encoding used for reading the grammar file(s)

### transducer

    private Transducer transducer

  The JAPE transducer.

### verbose

    private boolean verbose

  Whether to print progress messages or not.

### features

    private FeatureMap features

  Path to the resources tree

### progressListeners

    private transient Vector progressListeners

### statusListeners

    private transient Vector statusListeners

Constructor Detail

### Batch

    private Batch()

  Create non-initialised instance (private, used in main).

### Batch

    public Batch(URL url,
                 String encoding)
          throws JapeException

  Create a fully initialised instance.

  `japeFileName`: the name of a .jape or .ser transducer file. This may be an absolute path, or may a .jar that lives somewhere on the classpath.

### Batch

    public Batch(URL url,
                 String encoding,
                 StatusListener sListener)
          throws JapeException

Method Detail

### interrupt

    public void interrupt()

  Notifies this PR that it should stop its execution as soon as possible.

### getTransducer

    public Transducer getTransducer()

  Get the transducer.

### parseJape

    private void parseJape()
                    throws JapeException

  Parse a jape file from `japeURL` and store the transducer.

### transduce

    public void transduce(Corpus coll)
                   throws JapeException,
                          ExecutionException

  Process the given collection.

### transduce

    public void transduce(Document doc)
                   throws JapeException,
                          ExecutionException

  Process a single document.

### transduce

    public void transduce(Document doc,
                          AnnotationSet inputAS,
                          AnnotationSet outputAS)
                   throws JapeException,
                          ExecutionException

  Process a single document.

### main

    public static void main(String[] args)

  This is where it all happens. This is the place to be. Take your summer holidays here. Visit on Saturday nights. Buy a season ticket from `www.programmer.gone.insane.com`.

  Takes a .jape/.jar/.ser file name (-j option) which is assumed to hold a pattern grammar for a multi-phase transducer, and a collection name (-c option) or a list of files. As needed it then parses and compiles the transducer, then transduces all the documents in the collection and saves it to disk.

### setVerbose

    public void setVerbose(boolean turtleSoup)

  Set verbosity.

### usage

    public void usage(String errorMessage)

  You got something wrong, dumbo.

### message

    public void message(String mess)

  Hello? Anybody there??

### setFeatures

    public void setFeatures(FeatureMap newFeatures)

### getFeatures

    public FeatureMap getFeatures()

### removeProgressListener

    public void removeProgressListener(ProgressListener l)

### addProgressListener

    public void addProgressListener(ProgressListener l)

### fireProgressChanged

    protected void fireProgressChanged(int e)

### fireProcessFinished

    protected void fireProcessFinished()

### removeStatusListener

    public void removeStatusListener(StatusListener l)

### addStatusListener

    public void addStatusListener(StatusListener l)

### fireStatusChanged

    protected void fireStatusChanged(String e)