Package net.sf.okapi.steps.diffleverage
Class DiffLeverageStep
- java.lang.Object
-
- net.sf.okapi.common.pipeline.BasePipelineStep
-
- net.sf.okapi.steps.diffleverage.DiffLeverageStep
-
- All Implemented Interfaces:
IPipelineStep
public class DiffLeverageStep extends BasePipelineStep
Contextually match source "paragraphs" (full content of the TextUnit source) between two documents using a standard diff algorithm (http://en.wikipedia.org/wiki/Diff). The result is a new document with the translations from the old document copied into it. This allows translations between different document versions to be preserved while still maintaining the newer source document modifications. Adds theseAnnotations:AltTranslationsAnnotationon the target container.DiffMatchAnnotationon the target container (only applied if diffOnly is true)- Author:
- HARGRAVEJE
-
-
Constructor Summary
Constructors Constructor Description DiffLeverageStep()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDescription()Gets a short localizable description of what this step does.StringgetName()Gets the localizable name of this step.ParametersgetParameters()Gets the current parameters for this step.protected EventhandleDocumentPart(Event event)Handles theEventType.DOCUMENT_PARTevent.protected EventhandleEndBatch(Event event)Handles theEventType.END_BATCHevent.protected EventhandleEndDocument(Event event)Handles theEventType.END_DOCUMENTevent.protected EventhandleEndGroup(Event event)Handles theEventType.END_GROUPevent.protected EventhandleEndSubDocument(Event event)Handles theEventType.END_SUBDOCUMENTevent.protected EventhandleRawDocument(Event event)Handles theEventType.RAW_DOCUMENTevent.protected EventhandleStartBatch(Event event)Handles theEventType.START_BATCHevent.protected EventhandleStartDocument(Event event)Handles theEventType.START_DOCUMENTevent.protected EventhandleStartGroup(Event event)Handles theEventType.START_GROUPevent.protected EventhandleStartSubDocument(Event event)Handles theEventType.START_SUBDOCUMENTevent.protected EventhandleTextUnit(Event event)Handles theEventType.TEXT_UNITevent.booleanisDone()Steps that can generateEvents such asIFilters return false until no more events can be created.voidsetFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)voidsetParameters(IParameters params)Sets new parameters for this step.voidsetSecondInput(RawDocument secondInput)This is the old document (previously translated)voidsetSourceLocale(LocaleId sourceLocale)Delegate to concrete classvoidsetTargetLocale(LocaleId targetLocale)Target locale.voidsetTertiaryInput(RawDocument tertiaryInput)If set this is the old target that will be paragraph aligned with the old source.-
Methods inherited from class net.sf.okapi.common.pipeline.BasePipelineStep
cancel, destroy, getHelpLocation, getSourceLocale, getTargetLocale, handleCustom, handleEndBatchItem, handleEndSubfilter, handleEvent, handleMultiEvent, handlePipelineParameters, handleStartBatchItem, handleStartSubfilter, isLastOutputStep, setLastOutputStep
-
-
-
-
Method Detail
-
setFilterConfigurationMapper
public void setFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)
- Parameters:
fcMapper-
-
setSourceLocale
public void setSourceLocale(LocaleId sourceLocale)
Description copied from interface:IPipelineStepDelegate to concrete class- Specified by:
setSourceLocalein interfaceIPipelineStep- Overrides:
setSourceLocalein classBasePipelineStep- Parameters:
sourceLocale-
-
setTargetLocale
public void setTargetLocale(LocaleId targetLocale)
Target locale.- Specified by:
setTargetLocalein interfaceIPipelineStep- Overrides:
setTargetLocalein classBasePipelineStep- Parameters:
targetLocale-
-
setSecondInput
public void setSecondInput(RawDocument secondInput)
This is the old document (previously translated)- Parameters:
secondInput-
-
setTertiaryInput
public void setTertiaryInput(RawDocument tertiaryInput)
If set this is the old target that will be paragraph aligned with the old source.- Parameters:
tertiaryInput-
-
getDescription
public String getDescription()
Description copied from interface:IPipelineStepGets a short localizable description of what this step does.- Returns:
- the text of a short description of what this step does.
-
getName
public String getName()
Description copied from interface:IPipelineStepGets the localizable name of this step.- Returns:
- the localizable name of this step.
-
getParameters
public Parameters getParameters()
Description copied from interface:IPipelineStepGets the current parameters for this step.- Specified by:
getParametersin interfaceIPipelineStep- Overrides:
getParametersin 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:IPipelineStepSets new parameters for this step.- Specified by:
setParametersin interfaceIPipelineStep- Overrides:
setParametersin classBasePipelineStep- Parameters:
params- the new parameters to use.
-
handleStartBatch
protected Event handleStartBatch(Event event)
Description copied from class:BasePipelineStepHandles theEventType.START_BATCHevent.- Overrides:
handleStartBatchin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleEndBatch
protected Event handleEndBatch(Event event)
Description copied from class:BasePipelineStepHandles theEventType.END_BATCHevent.- Overrides:
handleEndBatchin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleRawDocument
protected Event handleRawDocument(Event event)
Description copied from class:BasePipelineStepHandles theEventType.RAW_DOCUMENTevent.- Overrides:
handleRawDocumentin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleStartDocument
protected Event handleStartDocument(Event event)
Description copied from class:BasePipelineStepHandles theEventType.START_DOCUMENTevent.- Overrides:
handleStartDocumentin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleEndDocument
protected Event handleEndDocument(Event event)
Description copied from class:BasePipelineStepHandles theEventType.END_DOCUMENTevent.- Overrides:
handleEndDocumentin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleStartSubDocument
protected Event handleStartSubDocument(Event event)
Description copied from class:BasePipelineStepHandles theEventType.START_SUBDOCUMENTevent.- Overrides:
handleStartSubDocumentin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleEndSubDocument
protected Event handleEndSubDocument(Event event)
Description copied from class:BasePipelineStepHandles theEventType.END_SUBDOCUMENTevent.- Overrides:
handleEndSubDocumentin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleStartGroup
protected Event handleStartGroup(Event event)
Description copied from class:BasePipelineStepHandles theEventType.START_GROUPevent.- Overrides:
handleStartGroupin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleEndGroup
protected Event handleEndGroup(Event event)
Description copied from class:BasePipelineStepHandles theEventType.END_GROUPevent.- Overrides:
handleEndGroupin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleTextUnit
protected Event handleTextUnit(Event event)
Description copied from class:BasePipelineStepHandles theEventType.TEXT_UNITevent.- Overrides:
handleTextUnitin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleDocumentPart
protected Event handleDocumentPart(Event event)
Description copied from class:BasePipelineStepHandles theEventType.DOCUMENT_PARTevent.- Overrides:
handleDocumentPartin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
isDone
public boolean isDone()
Description copied from interface:IPipelineStepSteps that can generateEvents such asIFilters return false until no more events can be created. Steps which do not createEvents always return true.- Specified by:
isDonein interfaceIPipelineStep- Overrides:
isDonein classBasePipelineStep- Returns:
- false if can generate more events, true otherwise.
-
-