public class SinglePhaseTransducer extends Transducer implements JapeConstants, Serializable
Modifier and Type | Class and Description |
---|---|
protected static class |
SinglePhaseTransducer.SearchState |
Modifier and Type | Field and Description |
---|---|
protected List<FSMInstance> |
activeFSMInstances
A list of FSM instances that haven't blocked yet, used during matching.
|
protected boolean |
finishedAlready
Whether the finish method has been called or not.
|
protected FSM |
fsm |
Set<String> |
input
Defines the types of input annotations that this transducer reads.
|
protected static org.apache.log4j.Logger |
log |
protected int |
ruleApplicationStyle
Type of rule application (constants defined in JapeConstants).
|
protected PrioritisedRuleList |
rules
The list of rules in this transducer.
|
actionContext, benchmarkFeatures, benchmarkID, enableDebugging, interrupted, name, ontology
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 and Description |
---|
SinglePhaseTransducer(String name)
Construction from name.
|
Modifier and Type | Method and Description |
---|---|
void |
addInput(String ident)
Adds a new type of input annotations used by this transducer.
|
void |
addProgressListener(ProgressListener l) |
void |
addRule(Rule rule)
Add a rule.
|
void |
cleanUp()
Clean up (delete action class files, for e.g.).
|
protected FSM |
createFSM() |
void |
finish(GateClassLoader classLoader)
Finish: replace dynamic data structures with Java arrays; called
after parsing.
|
protected void |
fireProcessFinished() |
protected void |
fireProgressChanged(int e)
This property affects the Appelt style of rules application.
|
protected boolean |
fireRule(List<FSMInstance> acceptingFSMInstances,
SinglePhaseTransducer.SearchState state,
long lastNodeOff,
SimpleSortedSet offsets,
AnnotationSet inputAS,
AnnotationSet outputAS,
Document doc,
SimpleSortedSet annotationsByOffset)
Fire the rule that matched.
|
String |
generateControllerEventBlocksCode(String packageName,
String className) |
ControllerEventBlocksAction |
getControllerEventBlocksActionClass()
This returns any compiled controller event blocks action class that
may exist at the time of calling or null.
|
FSM |
getFSM() |
String |
getOption(String name)
Get the value for a particular option.
|
protected Annotation |
getRightMostAnnotation(Collection<Annotation> annots)
Return the annotation with the right-most end node
|
int |
getRuleApplicationStyle() |
PrioritisedRuleList |
getRules() |
boolean |
hasInput(String ident)
Checks if this Phase has the annotation type as input.
|
boolean |
isInputRestricted()
Check if there is a restriction on the input annotation types
for this SPT, i.e. if there were annotation types specified for
the "Input:" declaration of this phase.
|
void |
removeProgressListener(ProgressListener 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 |
setControllerEventBlocks(String started,
String finished,
String aborted,
String javaimports) |
void |
setOption(String name,
String setting)
Add an option setting.
|
void |
setRuleApplicationStyle(int style)
Set the type of rule application (types defined in JapeConstants).
|
String |
toString()
A string representation of this object.
|
String |
toString(String pad)
A string representation of this object.
|
void |
transduce(Document doc,
AnnotationSet inputAS,
AnnotationSet outputAS)
Transduce a document using the annotation set provided and the
current rule application style.
|
addStatusListener, fireStatusChanged, getBaseURL, getBenchmarkId, getName, getOntology, interrupt, isDebugMode, isEnableDebugging, isInterrupted, isMatchGroupMode, isNegationCompatMode, removeStatusListener, setActionContext, setBaseURL, setBenchmarkId, setDebugMode, setEnableDebugging, setMatchGroupMode, setNegationCompatMode, setOntology
protected static final org.apache.log4j.Logger log
protected int ruleApplicationStyle
protected PrioritisedRuleList rules
protected List<FSMInstance> activeFSMInstances
protected boolean finishedAlready
public SinglePhaseTransducer(String name)
public void setRuleApplicationStyle(int style)
public void setOption(String name, String setting)
public void finish(GateClassLoader classLoader)
finish
in class Transducer
public void transduce(Document doc, AnnotationSet inputAS, AnnotationSet outputAS) throws JapeException, ExecutionException
transduce
in class Transducer
JapeException
ExecutionException
protected Annotation getRightMostAnnotation(Collection<Annotation> annots)
protected boolean fireRule(List<FSMInstance> acceptingFSMInstances, SinglePhaseTransducer.SearchState state, long lastNodeOff, SimpleSortedSet offsets, AnnotationSet inputAS, AnnotationSet outputAS, Document doc, SimpleSortedSet annotationsByOffset) throws JapeException, ExecutionException
JapeException
ExecutionException
public void cleanUp()
cleanUp
in class Transducer
public String toString(String pad)
toString
in class Transducer
public PrioritisedRuleList getRules()
public void addInput(String ident)
public boolean hasInput(String ident)
ident
- the type of an annotation to be checkedpublic boolean isInputRestricted()
public void removeProgressListener(ProgressListener l)
removeProgressListener
in class Transducer
public void addProgressListener(ProgressListener l)
addProgressListener
in class Transducer
protected void fireProgressChanged(int e)
Transducer
fireProgressChanged
in class Transducer
protected void fireProcessFinished()
fireProcessFinished
in class Transducer
public int getRuleApplicationStyle()
public void setControllerEventBlocks(String started, String finished, String aborted, String javaimports)
public String generateControllerEventBlocksCode(String packageName, String className)
public void runControllerExecutionStartedBlock(ActionContext ac, Controller c, Ontology o) throws ExecutionException
ExecutionException
public void runControllerExecutionFinishedBlock(ActionContext ac, Controller c, Ontology o) throws ExecutionException
ExecutionException
public void runControllerExecutionAbortedBlock(ActionContext ac, Controller c, Throwable t, Ontology o) throws ExecutionException
ExecutionException
public ControllerEventBlocksAction getControllerEventBlocksActionClass()