Class TuFilteringStep
- java.lang.Object
-
- net.sf.okapi.common.pipeline.BasePipelineStep
-
- net.sf.okapi.steps.common.tufiltering.TuFilteringStep
-
- All Implemented Interfaces:
AutoCloseable
,Function<Stream<Event>,Stream<Event>>
,IPipelineStep
public class TuFilteringStep extends BasePipelineStep
-
-
Constructor Summary
Constructors Constructor Description TuFilteringStep()
TuFilteringStep(ITextUnitFilter tuFilter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDescription()
Gets a short localizable description of what this step does.String
getName()
Gets the localizable name of this step.Parameters
getParameters()
Gets the current parameters for this step.protected Event
handleStartBatch(Event event)
Handles theEventType.START_BATCH
event.protected Event
handleTextUnit(Event event)
Handles theEventType.TEXT_UNIT
event.protected Event
processFiltered(Event tuEvent)
Process a given text unit event.void
setParameters(IParameters params)
Sets new parameters for this step.-
Methods inherited from class net.sf.okapi.common.pipeline.BasePipelineStep
cancel, destroy, getHelpLocation, getSourceLocale, getTargetLocale, handleCustom, handleDocumentPart, handleEndBatch, handleEndBatchItem, handleEndDocument, handleEndGroup, handleEndSubDocument, handleEndSubfilter, handleEvent, handleMultiEvent, handlePipelineParameters, handleRawDocument, handleStartBatchItem, handleStartDocument, handleStartGroup, handleStartSubDocument, handleStartSubfilter, isDone, isLastOutputStep, setLastOutputStep, setSourceLocale, setTargetLocale
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.okapi.common.pipeline.IPipelineStep
apply, close, handleStream
-
-
-
-
Constructor Detail
-
TuFilteringStep
public TuFilteringStep()
-
TuFilteringStep
public TuFilteringStep(ITextUnitFilter tuFilter)
-
-
Method Detail
-
getParameters
public Parameters getParameters()
Description copied from interface:IPipelineStep
Gets the current parameters for this step.- Specified by:
getParameters
in interfaceIPipelineStep
- Overrides:
getParameters
in classBasePipelineStep
- Returns:
- the current parameters for this step or null if there are no parameters.
-
setParameters
public void setParameters(IParameters params)
Description copied from interface:IPipelineStep
Sets new parameters for this step.- Specified by:
setParameters
in interfaceIPipelineStep
- Overrides:
setParameters
in classBasePipelineStep
- Parameters:
params
- the new parameters to use.
-
getName
public String getName()
Description copied from interface:IPipelineStep
Gets the localizable name of this step.- Returns:
- the localizable name of this step.
-
getDescription
public String getDescription()
Description copied from interface:IPipelineStep
Gets a short localizable description of what this step does.- Returns:
- the text of a short description of what this step does.
-
processFiltered
protected Event processFiltered(Event tuEvent)
Process a given text unit event. This method can modify the event's text unit resource, can drop the event and return NO_OP, can create and return a new event (for example, a DOCUMENT_PART event), or it can produce several events and return them packed in a MULTI_EVENT's resource.This method can be overridden in subclasses to change the way text unit events are processed if accepted.
If not overridden, clears the "translatable" flag of accepted text units, thus marking the text units non-translatable.
- Parameters:
tuEvent
- the text unit event which resource can be modified.- Returns:
- the modified event
-
handleStartBatch
protected Event handleStartBatch(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.START_BATCH
event.- Overrides:
handleStartBatch
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleTextUnit
protected Event handleTextUnit(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.TEXT_UNIT
event.- Overrides:
handleTextUnit
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
-