Package net.sf.okapi.steps.wordcount
Class CharacterCountStep
- java.lang.Object
-
- net.sf.okapi.common.pipeline.BasePipelineStep
-
- net.sf.okapi.steps.wordcount.CharacterCountStep
-
- All Implemented Interfaces:
AutoCloseable
,Function<Stream<Event>,Stream<Event>>
,IPipelineStep
public class CharacterCountStep extends BasePipelineStep
Character Counter pipeline step. The counter counts a number of characters in translatable text units. The count results are placed in a MetricsAnnotation structure (with the GMX TotalCharacterCount, WhiteSpaceCharacterCount, and PunctuationCharacterCount metrics set), attached to the respective event's resource (TEXT_UNIT, END_DOCUMENT, END_BATCH, END_BATCH_ITEM, END_SUBDOCUMENT, END_GROUP).
-
-
Constructor Summary
Constructors Constructor Description CharacterCountStep()
-
Method Summary
-
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
-
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
-
-
-
-
Method Detail
-
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.
-
getName
public String getName()
Description copied from interface:IPipelineStep
Gets the localizable name of this step.- Returns:
- the localizable name of this step.
-
saveCount
protected void saveCount(Metrics metrics, CharacterCounter.Counts count)
-
getBatchCount
public CharacterCounter.Counts getBatchCount()
-
getBatchItemCount
public CharacterCounter.Counts getBatchItemCount()
-
getDocumentCount
public CharacterCounter.Counts getDocumentCount()
-
getSubDocumentCount
public CharacterCounter.Counts getSubDocumentCount()
-
getGroupCount
public CharacterCounter.Counts getGroupCount()
-
saveToMetrics
protected void saveToMetrics(Event event, CharacterCounter.Counts count)
-
removeFromMetrics
protected void removeFromMetrics(IWithAnnotations res, String metricName)
-
removeFromMetrics
protected void removeFromMetrics(TextContainer textContainer, String metricName)
-
saveToMetrics
protected void saveToMetrics(TextContainer textContainer, CharacterCounter.Counts count)
-
saveToMetrics
protected void saveToMetrics(Segment seg, CharacterCounter.Counts count)
-
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.
-
handleEndBatch
protected Event handleEndBatch(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.END_BATCH
event.- Overrides:
handleEndBatch
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleStartBatchItem
protected Event handleStartBatchItem(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.START_BATCH_ITEM
event.- Overrides:
handleStartBatchItem
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleEndBatchItem
protected Event handleEndBatchItem(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.END_BATCH_ITEM
event.- Overrides:
handleEndBatchItem
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleStartDocument
protected Event handleStartDocument(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.START_DOCUMENT
event.- Overrides:
handleStartDocument
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleEndDocument
protected Event handleEndDocument(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.END_DOCUMENT
event.- Overrides:
handleEndDocument
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleStartSubDocument
protected Event handleStartSubDocument(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.START_SUBDOCUMENT
event.- Overrides:
handleStartSubDocument
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleEndSubDocument
protected Event handleEndSubDocument(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.END_SUBDOCUMENT
event.- Overrides:
handleEndSubDocument
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleStartGroup
protected Event handleStartGroup(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.START_GROUP
event.- Overrides:
handleStartGroup
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleEndGroup
protected Event handleEndGroup(Event event)
Description copied from class:BasePipelineStep
Handles theEventType.END_GROUP
event.- Overrides:
handleEndGroup
in classBasePipelineStep
- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
getSource
protected TextContainer getSource()
-
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.
-
-