public class DelimitedTextParser
extends java.lang.Object
| Constructor and Description |
|---|
DelimitedTextParser()
Constructor with default delimiter of white space, comment line
starting with '%', missing value placeholder "?", no column names,
no row names.
|
| Modifier and Type | Method and Description |
|---|---|
DelimitedTextParser |
addIgnoredColumn(int index)
Adds one columns index to ignore
|
DelimitedTextParser |
addIgnoredColumns(java.util.List<java.lang.Integer> ignoredColumns)
Adds several column indices to ignore
|
java.lang.String |
getCommentStartWith()
Returns the character/string that starts a comment line.
|
java.lang.String |
getDelimiter()
Returns the delimiter character/string.
|
java.lang.String |
getMissingValuePlaceholder()
Returns the missing value placeholder.
|
boolean |
hasColumnNames()
Returns if the dataset has column namesS (at row 0).
|
boolean |
hasRowNames()
Returns if the dataset has row names (at column 0).
|
AttributeDataset |
parse(Attribute[] attributes,
java.io.File file)
Parse a dataset from given file.
|
AttributeDataset |
parse(Attribute[] attributes,
java.lang.String path)
Parse a dataset from given file.
|
AttributeDataset |
parse(java.io.File file)
Parse a dataset from given file.
|
AttributeDataset |
parse(java.lang.String path)
Parse a dataset from given file.
|
AttributeDataset |
parse(java.lang.String name,
Attribute[] attributes,
java.io.File file)
Parse a dataset from given file.
|
AttributeDataset |
parse(java.lang.String name,
Attribute[] attributes,
java.lang.String path)
Parse a dataset from given file.
|
AttributeDataset |
parse(java.lang.String name,
Attribute[] attributes,
java.net.URI uri)
Parse a dataset from given URI.
|
AttributeDataset |
parse(java.lang.String name,
java.io.File file)
Parse a dataset from given file.
|
AttributeDataset |
parse(java.lang.String name,
java.io.InputStream stream)
Parse a dataset from an input stream.
|
AttributeDataset |
parse(java.net.URI uri)
Parse a dataset from given URI.
|
DelimitedTextParser |
setColumnNames(boolean hasColNames)
Set if the dataset has column names (at row 0).
|
DelimitedTextParser |
setCommentStartWith(java.lang.String comment)
Set the character/string that starts a comment line.
|
DelimitedTextParser |
setDelimiter(java.lang.String delimiter)
Set the delimiter character/string.
|
DelimitedTextParser |
setIgnoredColumns(java.util.List<java.lang.Integer> ignoredColumns)
Sets the list of column indices to ignore (starting at 0)
|
DelimitedTextParser |
setMissingValuePlaceholder(java.lang.String missing)
Set the missing value placeholder.
|
DelimitedTextParser |
setResponseIndex(Attribute response,
int index)
Sets the attribute and column index (starting at 0) of dependent/response variable.
|
DelimitedTextParser |
setRowNames(boolean hasRowNames)
Set if the dataset has row names (at column 0).
|
public DelimitedTextParser()
public java.lang.String getDelimiter()
public DelimitedTextParser setDelimiter(java.lang.String delimiter)
public java.lang.String getCommentStartWith()
public DelimitedTextParser setCommentStartWith(java.lang.String comment)
public java.lang.String getMissingValuePlaceholder()
public DelimitedTextParser setMissingValuePlaceholder(java.lang.String missing)
public DelimitedTextParser setResponseIndex(Attribute response, int index)
public DelimitedTextParser setIgnoredColumns(java.util.List<java.lang.Integer> ignoredColumns)
public DelimitedTextParser addIgnoredColumn(int index)
public DelimitedTextParser addIgnoredColumns(java.util.List<java.lang.Integer> ignoredColumns)
public boolean hasRowNames()
public DelimitedTextParser setRowNames(boolean hasRowNames)
public boolean hasColumnNames()
public DelimitedTextParser setColumnNames(boolean hasColNames)
public AttributeDataset parse(java.net.URI uri) throws java.io.IOException, java.text.ParseException
java.io.FileNotFoundExceptionjava.io.IOExceptionjava.text.ParseExceptionpublic AttributeDataset parse(java.lang.String name, Attribute[] attributes, java.net.URI uri) throws java.io.IOException, java.text.ParseException
uri - the URI of data source.attributes - the list attributes of data in proper order.java.io.FileNotFoundExceptionjava.io.IOExceptionjava.text.ParseExceptionpublic AttributeDataset parse(java.lang.String path) throws java.io.IOException, java.text.ParseException
path - the file path of data source.java.io.FileNotFoundExceptionjava.io.IOExceptionjava.text.ParseExceptionpublic AttributeDataset parse(Attribute[] attributes, java.lang.String path) throws java.io.IOException, java.text.ParseException
path - the file path of data source.attributes - the list attributes of data in proper order.java.io.FileNotFoundExceptionjava.io.IOExceptionjava.text.ParseExceptionpublic AttributeDataset parse(java.lang.String name, Attribute[] attributes, java.lang.String path) throws java.io.IOException, java.text.ParseException
path - the file path of data source.attributes - the list attributes of data in proper order.java.io.FileNotFoundExceptionjava.io.IOExceptionjava.text.ParseExceptionpublic AttributeDataset parse(java.io.File file) throws java.io.IOException, java.text.ParseException
file - the file of data source.java.io.FileNotFoundExceptionjava.io.IOExceptionjava.text.ParseExceptionpublic AttributeDataset parse(java.lang.String name, java.io.File file) throws java.io.IOException, java.text.ParseException
file - the file of data source.java.io.IOExceptionjava.text.ParseExceptionpublic AttributeDataset parse(Attribute[] attributes, java.io.File file) throws java.io.IOException, java.text.ParseException
file - the file of data source.attributes - the list attributes of data in proper order.java.io.IOExceptionjava.text.ParseExceptionpublic AttributeDataset parse(java.lang.String name, Attribute[] attributes, java.io.File file) throws java.io.IOException, java.text.ParseException
file - the file of data source.attributes - the list attributes of data in proper order.java.io.FileNotFoundExceptionjava.io.IOExceptionjava.text.ParseExceptionpublic AttributeDataset parse(java.lang.String name, java.io.InputStream stream) throws java.io.IOException, java.text.ParseException
name - the name of dataset.stream - the input stream of data.java.io.FileNotFoundExceptionjava.io.IOExceptionjava.text.ParseException