Package net.sf.okapi.filters.table.csv
Class CommaSeparatedValuesFilter
- java.lang.Object
-
- net.sf.okapi.common.filters.AbstractFilter
-
- net.sf.okapi.common.filters.AbstractLineFilter
-
- net.sf.okapi.filters.plaintext.base.BasePlainTextFilter
-
- net.sf.okapi.filters.table.base.BaseTableFilter
-
- net.sf.okapi.filters.table.csv.CommaSeparatedValuesFilter
-
- All Implemented Interfaces:
AutoCloseable,Iterator<Event>,IFilter
public class CommaSeparatedValuesFilter extends BaseTableFilter
Comma-Separated Values filter. Extracts text from a comma-separated values table, optionally containing a header with field names and other info.
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILTER_CONFIGstatic StringFILTER_NAMEstatic StringPROP_QUALIFIED-
Fields inherited from class net.sf.okapi.filters.table.base.BaseTableFilter
COLUMN_NUMBER, columnNames, commentColumns, commentSourceRefs, FILTER_MIME, METADATA_COLUMN_PREFIX, ROW_NUMBER, sourceColumns, sourceIdColumns, sourceIdSourceRefs, sourceIdSuffixes, targetColumns, targetLanguages, targetSourceRefs
-
Fields inherited from class net.sf.okapi.filters.plaintext.base.BasePlainTextFilter
FILTER_CONFIG_TRIM_ALL, FILTER_CONFIG_TRIM_TRAIL
-
Fields inherited from class net.sf.okapi.common.filters.AbstractLineFilter
input, LINE_NUMBER, srcLang, startDoc, trgLang
-
Fields inherited from interface net.sf.okapi.common.filters.IFilter
SUB_FILTER
-
-
Constructor Summary
Constructors Constructor Description CommaSeparatedValuesFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckTU(ITextUnit textUnit)ISkeletonWritercreateSkeletonWriter()Default case.protected voiddone()protected TextProcessingResultextractCells(List<ITextUnit> cells, TextContainer lineContainer, long lineNum)Splits line into table cells.protected StringgetFieldDelimiter()protected StringgetFieldQualifier()protected voidinit()protected booleanisEmpty(ITextUnit textUnit)protected booleanisMerging()protected booleanprocessTU(ITextUnit textUnit, ITextUnit sourceTextUnit)protected voidwaitForLine(boolean lastChance)Called by the filter when there are no input lines (the input has been read).-
Methods inherited from class net.sf.okapi.filters.table.base.BaseTableFilter
getColumnNames, isSendListedMode, processCells, processLine
-
Methods inherited from class net.sf.okapi.filters.plaintext.base.BasePlainTextFilter
callSubfilter, sendAsSkeleton, sendAsSkeleton, sendAsSkeleton, sendAsSource, sendAsSource, sendAsSource, sendAsTarget
-
Methods inherited from class net.sf.okapi.common.filters.AbstractLineFilter
addLineBreak, cancel, close, getActiveSkeleton, getFirstDocumentPart, getFirstTextUnit, getHeadSkeleton, getLineBreak, getQueueSize, getTargetLocale, hasNext, next, open, open, sendEvent, sendEvent
-
Methods inherited from class net.sf.okapi.common.filters.AbstractFilter
addConfiguration, addConfiguration, addConfiguration, addConfigurations, createEndFilterEvent, createFilterWriter, createStartFilterEvent, findConfiguration, getConfiguration, getConfigurations, getDisplayName, getDocumentId, getDocumentName, getEncoderManager, getEncoding, getFilterConfigurationMapper, getMimeType, getName, getNewlineType, getParameters, getParameters, getParametersClassName, getParentId, getSrcLoc, getTrgLoc, isCanceled, isGenerateSkeleton, isMultilingual, isUtf8Bom, isUtf8Encoding, removeConfiguration, setDisplayName, setDocumentName, setEncoding, setFilterConfigurationMapper, setGenerateSkeleton, setMimeType, setMultilingual, setName, setNewlineType, setOptions, setParameters, setParentId, setSrcLoc, setTrgLoc
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Field Detail
-
FILTER_NAME
public static final String FILTER_NAME
- See Also:
- Constant Field Values
-
FILTER_CONFIG
public static final String FILTER_CONFIG
- See Also:
- Constant Field Values
-
PROP_QUALIFIED
public static final String PROP_QUALIFIED
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
protected void init()
- Overrides:
initin classBaseTableFilter
-
getFieldDelimiter
protected String getFieldDelimiter()
- Overrides:
getFieldDelimiterin classBaseTableFilter
-
getFieldQualifier
protected String getFieldQualifier()
- Overrides:
getFieldQualifierin classBaseTableFilter
-
extractCells
protected TextProcessingResult extractCells(List<ITextUnit> cells, TextContainer lineContainer, long lineNum)
Description copied from class:BaseTableFilterSplits line into table cells.- Overrides:
extractCellsin classBaseTableFilter- Returns:
- string array of cells
-
processTU
protected boolean processTU(ITextUnit textUnit, ITextUnit sourceTextUnit)
- Overrides:
processTUin classBasePlainTextFilter
-
waitForLine
protected void waitForLine(boolean lastChance)
Description copied from class:AbstractLineFilterCalled by the filter when there are no input lines (the input has been read). Used to control implementation-specific internal buffers.- Overrides:
waitForLinein classAbstractLineFilter- Parameters:
lastChance- True if there are no events in the queue, and if the method will not produce events, the filter will be finished.
-
done
protected void done()
- Overrides:
donein classAbstractLineFilter
-
isMerging
protected boolean isMerging()
- Overrides:
isMergingin classBaseTableFilter
-
createSkeletonWriter
public ISkeletonWriter createSkeletonWriter()
Description copied from class:AbstractFilterDefault case. Override if needed.- Specified by:
createSkeletonWriterin interfaceIFilter- Overrides:
createSkeletonWriterin classAbstractFilter- Returns:
- new instance of
GenericSkeletonWriter
-
checkTU
protected boolean checkTU(ITextUnit textUnit)
- Overrides:
checkTUin classBasePlainTextFilter
-
isEmpty
protected boolean isEmpty(ITextUnit textUnit)
- Overrides:
isEmptyin classBasePlainTextFilter
-
-