|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.xml.dom.TokenWalker
de.fu_berlin.ties.filter.FilteringTokenWalker
de.fu_berlin.ties.filter.TrainableFilteringTokenWalker
public class TrainableFilteringTokenWalker
A filtering token walker that can be trained.
Constructor Summary | |
---|---|
TrainableFilteringTokenWalker(TokenProcessor processor,
TokenizerFactory tFactory,
TrainableFilter elementFilter,
SkipHandler sHandler,
Oracle elementOracle)
Creates a new instance, enabling training the filter. |
|
TrainableFilteringTokenWalker(TokenProcessor processor,
TokenizerFactory tFactory,
TrainableFilter elementFilter,
SkipHandler sHandler,
Oracle elementOracle,
boolean enableTraining)
Creates a new instance. |
Method Summary | |
---|---|
protected boolean |
handleAccept(Element element,
Element filteredElement,
boolean decision)
This method can be overwritten by subclasses to modify decisions of the element filter. This implementation relies on the oracle to make the final decision and joins the predicted decision and the correct
decision via OR. |
boolean |
isTrainingEnabled()
Returns true if training the embedded filter is enabled
(default). |
Methods inherited from class de.fu_berlin.ties.filter.FilteringTokenWalker |
---|
getAcceptedElements, getFilter, getRejectedElements, processToken, toString, walk |
Methods inherited from class de.fu_berlin.ties.xml.dom.TokenWalker |
---|
endElementHook, processCollectedText, startElementHook, trailingWhitespaceHook, walk |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TrainableFilteringTokenWalker(TokenProcessor processor, TokenizerFactory tFactory, TrainableFilter elementFilter, SkipHandler sHandler, Oracle elementOracle)
processor
- used to process the tokenstFactory
- used to instantiate tokenizerselementFilter
- the trainable element filter to usesHandler
- a handler that is called whenever some tokens are
skipped; may be null
elementOracle
- oracle queried to decide which elements should be
accepted by the trainable filterpublic TrainableFilteringTokenWalker(TokenProcessor processor, TokenizerFactory tFactory, TrainableFilter elementFilter, SkipHandler sHandler, Oracle elementOracle, boolean enableTraining)
processor
- used to process the tokenstFactory
- used to instantiate tokenizerselementFilter
- the trainable element filter to usesHandler
- a handler that is called whenever some tokens are
skipped; may be null
elementOracle
- oracle queried to decide which elements should be
accepted by the trainable filterenableTraining
- if true
the embedded filter is
trained from the decisions of the oracle; otherwise the oracle is only
queried to log if the filter made a mistakeMethod Detail |
---|
protected boolean handleAccept(Element element, Element filteredElement, boolean decision) throws ProcessingException
decision
and the correct
decision via OR. This allows the next step to view the tokenized text
in all necessary cases (if it should view it as determined by the oracle,
or it is would view it because of the the trainable classifer's
prediction). It also gives the trainable filter to chance to train itself
on the correct decision -- even if the original decision was already
correct since there are classifiers (e.g. Winnow) that are not purely
error-driven but also learn from reinforcement of (some) correct
instances.
handleAccept
in class FilteringTokenWalker
element
- the element to testfilteredElement
- the element that was actually filtered
(element
or a parent), or null
if the decision
had been cached (no filtering took place)decision
- the decision of the element filer
ProcessingException
- if an error occurs while revising the
decisionpublic boolean isTrainingEnabled()
true
if training the embedded filter is enabled
(default).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |