|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.converters.AbstractLoader
weka.core.converters.CSVLoader
Reads a text file that is comma or tab delimited..
Loader
,
Serialized FormField Summary | |
private FastVector |
m_cumulativeInstances
Holds instances accumulated so far |
private FastVector |
m_cumulativeStructure
A list of hash tables for accumulating nominal values during parsing. |
protected java.io.File |
m_sourceFile
Holds the source of the data set. |
protected Instances |
m_structure
Holds the determined structure (header) of the data set. |
Fields inherited from class weka.core.converters.AbstractLoader |
BATCH, INCREMENTAL, m_retrieval, NONE |
Constructor Summary | |
CSVLoader()
|
Method Summary | |
private void |
checkStructure(FastVector current)
Checks the current instance against what is known about the structure of the data set so far. |
Instances |
getDataSet()
Return the full data set. |
private FastVector |
getInstance(java.io.StreamTokenizer tokenizer)
Attempts to parse a line of the data set. |
Instance |
getNextInstance()
CSVLoader is unable to process a data set incrementally. |
Instances |
getStructure()
Determines and returns (if possible) the structure (internally the header) of the data set as an empty set of instances. |
java.lang.String |
globalInfo()
Returns a string describing this attribute evaluator |
private void |
initTokenizer(java.io.StreamTokenizer tokenizer)
Initializes the stream tokenizer |
static void |
main(java.lang.String[] args)
Main method. |
private void |
readHeader(java.io.StreamTokenizer tokenizer)
Assumes the first line of the file contains the attribute names. |
private void |
readStructure(java.io.StreamTokenizer st)
|
void |
reset()
Resets the loader ready to read a new data set |
void |
setSource(java.io.File file)
Resets the Loader object and sets the source of the data set to be the supplied File object. |
Methods inherited from class weka.core.converters.AbstractLoader |
getRetrieval, setRetrieval, setSource |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Instances m_structure
protected java.io.File m_sourceFile
private FastVector m_cumulativeStructure
private FastVector m_cumulativeInstances
Constructor Detail |
public CSVLoader()
Method Detail |
public java.lang.String globalInfo()
public void reset()
public void setSource(java.io.File file) throws java.io.IOException
setSource
in interface Loader
setSource
in class AbstractLoader
file
- the source file.
java.io.IOException
- if an error occurspublic Instances getStructure() throws java.io.IOException
getStructure
in interface Loader
getStructure
in class AbstractLoader
java.io.IOException
- if an error occursprivate void readStructure(java.io.StreamTokenizer st) throws java.io.IOException
java.io.IOException
public Instances getDataSet() throws java.io.IOException
getDataSet
in interface Loader
getDataSet
in class AbstractLoader
java.io.IOException
- if there is no source or parsing failspublic Instance getNextInstance() throws java.io.IOException
getNextInstance
in interface Loader
getNextInstance
in class AbstractLoader
java.io.IOException
- always. CSVLoader is unable to process a data
set incrementally.private FastVector getInstance(java.io.StreamTokenizer tokenizer) throws java.io.IOException
tokenizer
- the tokenizer
java.io.IOException
- if an error occurs
private_normal_behavior requires: tokenizer != null; ensures: \result != null; also private_exceptional_behavior requires: tokenizer == null || (* unsucessful parse *); signals: (IOException);
private void checkStructure(FastVector current) throws java.lang.Exception
current
- a FastVector
value
java.lang.Exception
- if an error occurs
private_normal_behavior requires: current != null; also private_exceptional_behavior requires: current == null || (* unrecognized object type in current *); signals: (Exception);
private void readHeader(java.io.StreamTokenizer tokenizer) throws java.io.IOException
tokenizer
- a StreamTokenizer
value
java.io.IOException
- if an error occurs
private_normal_behavior requires: tokenizer != null; modifiable: m_structure; ensures: m_structure != null; also private_exceptional_behavior requires: tokenizer == null || (* unsucessful parse *); signals: (IOException);
private void initTokenizer(java.io.StreamTokenizer tokenizer)
tokenizer
- the tokenizer to initializepublic static void main(java.lang.String[] args)
args
- should contain the name of an input file.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |