Class BaseCountStep
- java.lang.Object
-
- net.sf.okapi.common.pipeline.BasePipelineStep
-
- net.sf.okapi.steps.wordcount.common.BaseCountStep
-
- All Implemented Interfaces:
IPipelineStep
- Direct Known Subclasses:
AltAnnotationBasedCountStep,GMXProtectedWordCountStep,TokenCountStep
public abstract class BaseCountStep extends BasePipelineStep
Base abstract class for different counter steps (word count step, character count step, etc.).
-
-
Constructor Summary
Constructors Constructor Description BaseCountStep()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract longcount(Segment segment, LocaleId locale)protected abstract longcount(TextContainer textContainer, LocaleId locale)protected abstract longcountInTextUnit(ITextUnit textUnit)protected abstract booleancountOnlyTranslatable()longgetBatchCount()longgetBatchItemCount()abstract StringgetDescription()Gets a short localizable description of what this step does.longgetDocumentCount()longgetGroupCount()abstract StringgetMetric()abstract StringgetName()Gets the localizable name of this step.protected TextContainergetSource()longgetSubDocumentCount()protected EventhandleEndBatch(Event event)Handles theEventType.END_BATCHevent.protected EventhandleEndBatchItem(Event event)Handles theEventType.END_BATCH_ITEMevent.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 EventhandleStartBatch(Event event)Handles theEventType.START_BATCHevent.protected EventhandleStartBatchItem(Event event)Handles theEventType.START_BATCH_ITEMevent.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.protected voidremoveFromMetrics(IWithAnnotations res, String metricName)protected voidremoveFromMetrics(Segment seg, String metricName)protected voidremoveFromMetrics(TextContainer textContainer, String metricName)protected voidsaveCount(Metrics metrics, long count)protected voidsaveToMetrics(Event event, long count)protected voidsaveToMetrics(Segment seg, long count)protected voidsaveToMetrics(TextContainer textContainer, long count)-
Methods inherited from class net.sf.okapi.common.pipeline.BasePipelineStep
cancel, destroy, getHelpLocation, getParameters, getSourceLocale, getTargetLocale, handleCustom, handleDocumentPart, handleEndSubfilter, handleEvent, handleMultiEvent, handlePipelineParameters, handleRawDocument, handleStartSubfilter, isDone, isLastOutputStep, setLastOutputStep, setParameters, setSourceLocale, setTargetLocale
-
-
-
-
Method Detail
-
getName
public abstract String getName()
Description copied from interface:IPipelineStepGets the localizable name of this step.- Returns:
- the localizable name of this step.
-
getDescription
public abstract 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.
-
getMetric
public abstract String getMetric()
-
count
protected abstract long count(TextContainer textContainer, LocaleId locale)
-
countInTextUnit
protected abstract long countInTextUnit(ITextUnit textUnit)
-
countOnlyTranslatable
protected abstract boolean countOnlyTranslatable()
-
saveCount
protected void saveCount(Metrics metrics, long count)
-
getBatchCount
public long getBatchCount()
-
getBatchItemCount
public long getBatchItemCount()
-
getDocumentCount
public long getDocumentCount()
-
getSubDocumentCount
public long getSubDocumentCount()
-
getGroupCount
public long getGroupCount()
-
saveToMetrics
protected void saveToMetrics(Event event, long count)
-
removeFromMetrics
protected void removeFromMetrics(IWithAnnotations res, String metricName)
-
removeFromMetrics
protected void removeFromMetrics(TextContainer textContainer, String metricName)
-
saveToMetrics
protected void saveToMetrics(TextContainer textContainer, long count)
-
saveToMetrics
protected void saveToMetrics(Segment seg, long count)
-
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.
-
handleStartBatchItem
protected Event handleStartBatchItem(Event event)
Description copied from class:BasePipelineStepHandles theEventType.START_BATCH_ITEMevent.- Overrides:
handleStartBatchItemin classBasePipelineStep- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleEndBatchItem
protected Event handleEndBatchItem(Event event)
Description copied from class:BasePipelineStepHandles theEventType.END_BATCH_ITEMevent.- Overrides:
handleEndBatchItemin 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.
-
getSource
protected TextContainer getSource()
-
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.
-
-