gate.jape
Class Batch

java.lang.Object
  extended by gate.jape.Batch
All Implemented Interfaces:
JapeConstants, Benchmarkable, Serializable

public class Batch
extends Object
implements JapeConstants, Benchmarkable

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

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface gate.jape.JapeConstants
ALL_STYLE, APPELT_STYLE, BRILL_STYLE, DEFAULT_PRIORITY, FIRST_STYLE, INDENT_PADDING, KLEENE_PLUS, KLEENE_QUERY, KLEENE_STAR, MULTI_SPAN_BINDING, NO_BINDING, NO_KLEENE_OP, ONCE_STYLE, SINGLE_SPAN_BINDING
 
Constructor Summary
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)
           
 String getBenchmarkId()
          Returns the benchmark ID of this resource.
 FeatureMap getFeatures()
           
 Transducer getTransducer()
          Get the transducer.
 void interrupt()
          Notifies this PR that it should stop its execution as soon as possible.
 boolean isEnableDebugging()
           
protected  void linkListeners()
          Creates inner listeners that forward events from the transducer object to our own listeners.
static void main(String[] args)
          This is where it all happens.
 void message(String mess)
          Hello?
 void removeProgressListener(ProgressListener l)
           
 void removeStatusListener(StatusListener l)
           
 void runControllerExecutionAbortedBlock(ActionContext ac, Controller c, Throwable t, Ontology o)
           
 void runControllerExecutionFinishedBlock(ActionContext ac, Controller c, Ontology o)
           
 void runControllerExecutionStartedBlock(ActionContext ac, Controller c, Ontology o)
           
 void setActionContext(ActionContext ac)
           
 void setBenchmarkId(String benchmarkId)
          This method sets the benchmarkID for this resource.
 void setEnableDebugging(boolean enableDebugging)
           
 void setFeatures(FeatureMap newFeatures)
           
 void setOntology(Ontology ontology)
          Sets the ontology to be used by the transducers
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.

Throws:
JapeException

Batch

public Batch(URL url,
             String encoding,
             StatusListener sListener)
      throws JapeException
Throws:
JapeException
Method Detail

setActionContext

public void setActionContext(ActionContext ac)

linkListeners

protected void linkListeners()
Creates inner listeners that forward events from the transducer object to our own listeners.


interrupt

public void interrupt()
Notifies this PR that it should stop its execution as soon as possible.


getTransducer

public Transducer getTransducer()
Get the transducer.


transduce

public void transduce(Corpus coll)
               throws JapeException,
                      ExecutionException
Process the given collection.

Throws:
JapeException
ExecutionException

transduce

public void transduce(Document doc)
               throws JapeException,
                      ExecutionException
Process a single document.

Throws:
JapeException
ExecutionException

transduce

public void transduce(Document doc,
                      AnnotationSet inputAS,
                      AnnotationSet outputAS)
               throws JapeException,
                      ExecutionException
Process a single document.

Throws:
JapeException
ExecutionException

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)

setOntology

public void setOntology(Ontology ontology)
Sets the ontology to be used by the transducers

Parameters:
ontology -

isEnableDebugging

public boolean isEnableDebugging()

setEnableDebugging

public void setEnableDebugging(boolean enableDebugging)

getBenchmarkId

public String getBenchmarkId()
Description copied from interface: Benchmarkable
Returns the benchmark ID of this resource.

Specified by:
getBenchmarkId in interface Benchmarkable

setBenchmarkId

public void setBenchmarkId(String benchmarkId)
Description copied from interface: Benchmarkable
This method sets the benchmarkID for this resource. The resource must use this as the prefix for any sub-events it logs.

Specified by:
setBenchmarkId in interface Benchmarkable
Parameters:
benchmarkId - the benchmark ID, which must not contain spaces as it is already used as a separator in the log, you can use Benchmark.createBenchmarkId(String, String) for it.

runControllerExecutionAbortedBlock

public void runControllerExecutionAbortedBlock(ActionContext ac,
                                               Controller c,
                                               Throwable t,
                                               Ontology o)
                                        throws ExecutionException
Throws:
ExecutionException

runControllerExecutionFinishedBlock

public void runControllerExecutionFinishedBlock(ActionContext ac,
                                                Controller c,
                                                Ontology o)
                                         throws ExecutionException
Throws:
ExecutionException

runControllerExecutionStartedBlock

public void runControllerExecutionStartedBlock(ActionContext ac,
                                               Controller c,
                                               Ontology o)
                                        throws ExecutionException
Throws:
ExecutionException