Class CSVLineSequenceRecordReader
- java.lang.Object
-
- org.datavec.api.records.reader.BaseRecordReader
-
- org.datavec.api.records.reader.impl.LineRecordReader
-
- org.datavec.api.records.reader.impl.csv.CSVRecordReader
-
- org.datavec.api.records.reader.impl.csv.CSVLineSequenceRecordReader
-
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,Configurable,RecordReader,SequenceRecordReader
public class CSVLineSequenceRecordReader extends CSVRecordReader implements SequenceRecordReader
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.datavec.api.records.reader.impl.csv.CSVRecordReader
DEFAULT_DELIMITER, DEFAULT_QUOTE, DELIMITER, QUOTE, SKIP_NUM_LINES, skipNumLines
-
Fields inherited from class org.datavec.api.records.reader.impl.LineRecordReader
charset, conf, initialized, lineIndex, locations, splitIndex
-
Fields inherited from class org.datavec.api.records.reader.BaseRecordReader
inputSplit, listeners, streamCreatorFn
-
Fields inherited from interface org.datavec.api.records.reader.RecordReader
APPEND_LABEL, LABELS, NAME_SPACE
-
-
Constructor Summary
Constructors Constructor Description CSVLineSequenceRecordReader()Default settings: skip 0 lines, use ',' as the delimiter, and '"' for quotesCSVLineSequenceRecordReader(int skipNumLines, char delimiter)Skip lines and use delimiterCSVLineSequenceRecordReader(int skipNumLines, char delimiter, char quote)Skip lines, use delimiter, and strip quotes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SequenceRecordconvert(Record r)List<SequenceRecord>loadSequenceFromMetaData(List<RecordMetaData> recordMetaDatas)Load multiple sequence records from the given a list ofRecordMetaDatainstancesSequenceRecordloadSequenceFromMetaData(RecordMetaData recordMetaData)Load a single sequence record from the givenRecordMetaDatainstance
Note: that for data that isn't splittable (i.e., text data that needs to be scanned/split), it is more efficient to load multiple records at once usingSequenceRecordReader.loadSequenceFromMetaData(List)SequenceRecordnextSequence()Similar toSequenceRecordReader.sequenceRecord(), but returns aRecordobject, that may include metadata such as the source of the dataList<List<Writable>>sequenceRecord()Returns a sequence record.List<List<Writable>>sequenceRecord(URI uri, DataInputStream dataInputStream)Load a sequence record from the given DataInputStream UnlikeRecordReader.next()the internal state of the RecordReader is not modified Implementations of this method should not close the DataInputStream-
Methods inherited from class org.datavec.api.records.reader.impl.csv.CSVRecordReader
batchesSupported, hasNext, initialize, loadFromMetaData, loadFromMetaData, next, next, nextRecord, onLocationOpen, parseLine, readStringLine, record, reset
-
Methods inherited from class org.datavec.api.records.reader.impl.LineRecordReader
close, closeIfRequired, getConf, getIterator, getLabels, initialize, resetSupported, setConf
-
Methods inherited from class org.datavec.api.records.reader.BaseRecordReader
getListeners, invokeListeners, setListeners, setListeners
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.datavec.api.conf.Configurable
getConf, setConf
-
Methods inherited from interface org.datavec.api.records.reader.RecordReader
batchesSupported, getLabels, getListeners, hasNext, initialize, initialize, loadFromMetaData, loadFromMetaData, next, next, nextRecord, record, reset, resetSupported, setListeners, setListeners
-
-
-
-
Constructor Detail
-
CSVLineSequenceRecordReader
public CSVLineSequenceRecordReader()
Default settings: skip 0 lines, use ',' as the delimiter, and '"' for quotes
-
CSVLineSequenceRecordReader
public CSVLineSequenceRecordReader(int skipNumLines, char delimiter)Skip lines and use delimiter- Parameters:
skipNumLines- the number of lines to skipdelimiter- the delimiter
-
CSVLineSequenceRecordReader
public CSVLineSequenceRecordReader(int skipNumLines, char delimiter, char quote)Skip lines, use delimiter, and strip quotes- Parameters:
skipNumLines- the number of lines to skipdelimiter- the delimiterquote- the quote to strip
-
-
Method Detail
-
sequenceRecord
public List<List<Writable>> sequenceRecord()
Description copied from interface:SequenceRecordReaderReturns a sequence record.- Specified by:
sequenceRecordin interfaceSequenceRecordReader- Returns:
- a sequence of records
-
sequenceRecord
public List<List<Writable>> sequenceRecord(URI uri, DataInputStream dataInputStream) throws IOException
Description copied from interface:SequenceRecordReaderLoad a sequence record from the given DataInputStream UnlikeRecordReader.next()the internal state of the RecordReader is not modified Implementations of this method should not close the DataInputStream- Specified by:
sequenceRecordin interfaceSequenceRecordReader- Throws:
IOException- if error occurs during reading from the input stream
-
nextSequence
public SequenceRecord nextSequence()
Description copied from interface:SequenceRecordReaderSimilar toSequenceRecordReader.sequenceRecord(), but returns aRecordobject, that may include metadata such as the source of the data- Specified by:
nextSequencein interfaceSequenceRecordReader- Returns:
- next sequence record
-
loadSequenceFromMetaData
public SequenceRecord loadSequenceFromMetaData(RecordMetaData recordMetaData) throws IOException
Description copied from interface:SequenceRecordReaderLoad a single sequence record from the givenRecordMetaDatainstance
Note: that for data that isn't splittable (i.e., text data that needs to be scanned/split), it is more efficient to load multiple records at once usingSequenceRecordReader.loadSequenceFromMetaData(List)- Specified by:
loadSequenceFromMetaDatain interfaceSequenceRecordReader- Parameters:
recordMetaData- Metadata for the sequence record that we want to load from- Returns:
- Single sequence record for the given RecordMetaData instance
- Throws:
IOException- If I/O error occurs during loading
-
loadSequenceFromMetaData
public List<SequenceRecord> loadSequenceFromMetaData(List<RecordMetaData> recordMetaDatas) throws IOException
Description copied from interface:SequenceRecordReaderLoad multiple sequence records from the given a list ofRecordMetaDatainstances- Specified by:
loadSequenceFromMetaDatain interfaceSequenceRecordReader- Parameters:
recordMetaDatas- Metadata for the records that we want to load from- Returns:
- Multiple sequence record for the given RecordMetaData instances
- Throws:
IOException- If I/O error occurs during loading
-
convert
protected SequenceRecord convert(Record r)
-
-