at.ofai.gate.japeparms
Class JapeParms
java.lang.Object
gate.util.AbstractFeatureBearer
gate.creole.AbstractResource
gate.creole.AbstractProcessingResource
gate.creole.AbstractLanguageAnalyser
at.ofai.gate.japeparms.JapeParms
- All Implemented Interfaces:
- gate.creole.ANNIEConstants, gate.creole.ControllerAwarePR, gate.Executable, gate.LanguageAnalyser, gate.ProcessingResource, gate.Resource, gate.util.Benchmarkable, gate.util.FeatureBearer, gate.util.NameBearer, Serializable
@CreoleResource(name="JapeParms",
comment="Add a descriptive comment about this resource")
public class JapeParms
- extends gate.creole.AbstractLanguageAnalyser
- implements gate.creole.ControllerAwarePR, gate.util.Benchmarkable
This class is the implementation of the PR resource JapeParms.
The resource wraps a JAPE Transducer and replaces variables in the
JAPE file with the values from a feature map that is specified as
init-parameter "variables" before passing the modified JAPE file on
to the wrapped JAPE Transducers.
The JAPE grammar should follow the syntax needed by the String Template
Engine: http://www.antlr.org/wiki/display/ST4/StringTemplate+4+Documentation
Variables must be delimited by "$" at the beginning and end, not enclosed
between "<" and ">", for example: $var1$ would be the template variable
var1.
The variables from the feature map are not only replaced in the JAPE
grammer template but also passed on as the value of feature "$VARS$"
for ctx.getPRFeatures().
NOTE: this is a preliminary implementation and most of it may change
in the future!!
- Author:
- Johann Petrak
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class gate.creole.AbstractProcessingResource |
gate.creole.AbstractProcessingResource.InternalStatusListener, gate.creole.AbstractProcessingResource.IntervalProgressListener |
Fields inherited from class gate.creole.AbstractLanguageAnalyser |
corpus, document |
Fields inherited from class gate.creole.AbstractProcessingResource |
interrupted |
Fields inherited from class gate.creole.AbstractResource |
name |
Fields inherited from class gate.util.AbstractFeatureBearer |
features |
Fields inherited from interface gate.creole.ANNIEConstants |
ANNOTATION_COREF_FEATURE_NAME, DATE_ANNOTATION_TYPE, DATE_POSTED_ANNOTATION_TYPE, DEFAULT_FILE, DOCUMENT_COREF_FEATURE_NAME, JOB_ID_ANNOTATION_TYPE, LOCATION_ANNOTATION_TYPE, LOOKUP_ANNOTATION_TYPE, LOOKUP_CLASS_FEATURE_NAME, LOOKUP_INSTANCE_FEATURE_NAME, LOOKUP_LANGUAGE_FEATURE_NAME, LOOKUP_MAJOR_TYPE_FEATURE_NAME, LOOKUP_MINOR_TYPE_FEATURE_NAME, LOOKUP_ONTOLOGY_FEATURE_NAME, MONEY_ANNOTATION_TYPE, ORGANIZATION_ANNOTATION_TYPE, PERSON_ANNOTATION_TYPE, PERSON_GENDER_FEATURE_NAME, PLUGIN_DIR, PR_NAMES, SENTENCE_ANNOTATION_TYPE, SPACE_TOKEN_ANNOTATION_TYPE, TOKEN_ANNOTATION_TYPE, TOKEN_CATEGORY_FEATURE_NAME, TOKEN_KIND_FEATURE_NAME, TOKEN_LENGTH_FEATURE_NAME, TOKEN_ORTH_FEATURE_NAME, TOKEN_STRING_FEATURE_NAME |
Methods inherited from class gate.creole.AbstractLanguageAnalyser |
getCorpus, getDocument, setCorpus, setDocument |
Methods inherited from class gate.creole.AbstractProcessingResource |
addProgressListener, addStatusListener, fireProcessFinished, fireProgressChanged, fireStatusChanged, getRuntimeParameterValues, getRuntimeParameterValues, isInterrupted, removeProgressListener, removeStatusListener |
Methods inherited from class gate.creole.AbstractResource |
checkParameterValues, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners |
Methods inherited from class gate.util.AbstractFeatureBearer |
getFeatures, setFeatures |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface gate.Resource |
getParameterValue, setParameterValue, setParameterValues |
Methods inherited from interface gate.util.FeatureBearer |
getFeatures, setFeatures |
Methods inherited from interface gate.util.NameBearer |
getName, setName |
Methods inherited from interface gate.Executable |
isInterrupted |
theTransducerPR
protected gate.LanguageAnalyser theTransducerPR
generatedGrammarFile
protected File generatedGrammarFile
generatedFileURL
protected URL generatedFileURL
JapeParms
public JapeParms()
setKnownTransducer
@CreoleParameter(comment="Select a predefined known JAPE Transducer. To specify you own use otherTransducerClassname",
defaultValue="JAPE_CLASSIC")
public void setKnownTransducer(KnownJapeTransducers which)
getKnownTransducer
public KnownJapeTransducers getKnownTransducer()
setOtherTransducerClassname
@Optional
@CreoleParameter(comment="If given, use this classname instead of a known one",
defaultValue="")
public void setOtherTransducerClassname(String classname)
getOtherTransducerClassname
public String getOtherTransducerClassname()
setPluginDirectoryURL
@Optional
@CreoleParameter(comment="Specify where the JAPE Transducer is available if needed")
public void setPluginDirectoryURL(URL theURL)
getPluginDirectoryURL
public URL getPluginDirectoryURL()
setAnnotationAccessors
@Optional
@CreoleParameter(comment="Class names that implement gate.jape.constraint.AnnotationAccessor.")
public void setAnnotationAccessors(List<String> annotationAccessors)
getAnnotationAccessors
public List<String> getAnnotationAccessors()
setBenchmarkId
public void setBenchmarkId(String benchmarkId)
- Specified by:
setBenchmarkId
in interface gate.util.Benchmarkable
getBenchmarkId
public String getBenchmarkId()
- Specified by:
getBenchmarkId
in interface gate.util.Benchmarkable
setEncoding
@CreoleParameter(comment="The encoding used for reading the grammar",
defaultValue="UTF-8")
public void setEncoding(String newEncoding)
getEncoding
public String getEncoding()
setGrammarURL
@CreoleParameter(comment="The URL to the grammar file. Variables should be enclosed between $ chars.",
suffixes="jape")
public void setGrammarURL(URL newGrammarURL)
getGrammarURL
public URL getGrammarURL()
setTempDirectoryURL
@Optional
@CreoleParameter(comment="The file: URL of a directory where to store the generated file. The default is either a known tmp dir or the same dir the grammar file is in.")
public void setTempDirectoryURL(URL url)
getTempDirectoryURL
public URL getTempDirectoryURL()
setVariables
@CreoleParameter(comment="Variables to use and substitute in the JAPE grammer template. Do not include the enclosing $s")
public void setVariables(gate.FeatureMap vars)
getVariables
public gate.FeatureMap getVariables()
setInputASName
@RunTime
@Optional
@CreoleParameter(comment="The annotation set to be used as input for the transducer",
defaultValue="")
public void setInputASName(String newInputASName)
getInputASName
public String getInputASName()
setOutputASName
@RunTime
@Optional
@CreoleParameter(comment="The annotation set to be used as output for the transducer",
defaultValue="")
public void setOutputASName(String newOutputASName)
getOutputASName
public String getOutputASName()
setOntology
@RunTime
@Optional
@CreoleParameter(comment="The ontology to be used by this transducer")
public void setOntology(gate.creole.ontology.Ontology ontology)
getOntology
public gate.creole.ontology.Ontology getOntology()
setOperators
@Optional
@CreoleParameter(comment="Class names that implement gate.jape.constraint.ConstraintPredicate.")
public void setOperators(List<String> operators)
getOperators
public List<String> getOperators()
init
public gate.Resource init()
throws gate.creole.ResourceInstantiationException
- Specified by:
init
in interface gate.Resource
- Overrides:
init
in class gate.creole.AbstractProcessingResource
- Throws:
gate.creole.ResourceInstantiationException
reInit
public void reInit()
throws gate.creole.ResourceInstantiationException
- Specified by:
reInit
in interface gate.ProcessingResource
- Overrides:
reInit
in class gate.creole.AbstractProcessingResource
- Throws:
gate.creole.ResourceInstantiationException
regenerateInputFile
protected void regenerateInputFile(URL originalURL,
URL dirURL,
gate.FeatureMap variables)
throws gate.creole.ResourceInstantiationException
- Throws:
gate.creole.ResourceInstantiationException
readURL2String
protected String readURL2String(URL url,
String encoding)
throws IOException
- Throws:
IOException
execute
public void execute()
throws gate.creole.ExecutionException
- Specified by:
execute
in interface gate.Executable
- Overrides:
execute
in class gate.creole.AbstractProcessingResource
- Throws:
gate.creole.ExecutionException
interrupt
public void interrupt()
- Specified by:
interrupt
in interface gate.Executable
- Overrides:
interrupt
in class gate.creole.AbstractProcessingResource
cleanup
public void cleanup()
- Specified by:
cleanup
in interface gate.Resource
- Overrides:
cleanup
in class gate.creole.AbstractProcessingResource
controllerExecutionStarted
public void controllerExecutionStarted(gate.Controller c)
throws gate.creole.ExecutionException
- Specified by:
controllerExecutionStarted
in interface gate.creole.ControllerAwarePR
- Throws:
gate.creole.ExecutionException
controllerExecutionFinished
public void controllerExecutionFinished(gate.Controller c)
throws gate.creole.ExecutionException
- Specified by:
controllerExecutionFinished
in interface gate.creole.ControllerAwarePR
- Throws:
gate.creole.ExecutionException
controllerExecutionAborted
public void controllerExecutionAborted(gate.Controller c,
Throwable t)
throws gate.creole.ExecutionException
- Specified by:
controllerExecutionAborted
in interface gate.creole.ControllerAwarePR
- Throws:
gate.creole.ExecutionException