|
||||||||||
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.AbstractFileLoader
weka.core.converters.ArffLoader
public class ArffLoader
Reads a source that is in arff (attribute relation file format) format.
Loader
,
Serialized FormNested Class Summary | |
---|---|
static class |
ArffLoader.ArffReader
Reads data from an ARFF file, either in incremental or batch mode. |
Field Summary | |
---|---|
static java.lang.String |
FILE_EXTENSION
the file extension |
static java.lang.String |
FILE_EXTENSION_COMPRESSED
|
Fields inherited from interface weka.core.converters.Loader |
---|
BATCH, INCREMENTAL, NONE |
Constructor Summary | |
---|---|
ArffLoader()
|
Method Summary | |
---|---|
Instances |
getDataSet()
Return the full data set. |
java.lang.String |
getFileDescription()
Returns a description of the file type. |
java.lang.String |
getFileExtension()
Get the file extension used for arff files |
java.lang.String[] |
getFileExtensions()
Gets all the file extensions used for this type of file |
Instance |
getNextInstance(Instances structure)
Read the data set incrementally---get the next instance in the data set or returns null if there are no more instances to get. |
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier. |
boolean |
getRetainStringValues()
Get whether to retain all string values for string in the header when reading incrementally |
java.lang.String |
getRevision()
Returns the revision string. |
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 Loader |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(java.lang.String[] args)
Main method. |
void |
reset()
Resets the Loader ready to read a new data set or the same data set again. |
java.lang.String |
retainStringValuesTipText()
the tip text for this property |
java.io.File |
retrieveFile()
get the File specified as the source |
java.lang.String |
retrieveURL()
Return the current url |
void |
setFile(java.io.File file)
sets the source File |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setRetainStringValues(boolean r)
Set whether to retain all string values for string in the header when reading incrementally |
void |
setSource(java.io.InputStream in)
Resets the Loader object and sets the source of the data set to be the supplied InputStream. |
void |
setSource(java.net.URL url)
Resets the Loader object and sets the source of the data set to be the supplied url. |
void |
setURL(java.lang.String url)
Set the url to load from |
Methods inherited from class weka.core.converters.AbstractFileLoader |
---|
getUseRelativePath, runFileLoader, setEnvironment, setSource, setUseRelativePath, useRelativePathTipText |
Methods inherited from class weka.core.converters.AbstractLoader |
---|
setRetrieval |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String FILE_EXTENSION
public static java.lang.String FILE_EXTENSION_COMPRESSED
Constructor Detail |
---|
public ArffLoader()
Method Detail |
---|
public java.lang.String globalInfo()
public java.lang.String getFileExtension()
getFileExtension
in interface FileSourcedConverter
public java.lang.String[] getFileExtensions()
getFileExtensions
in interface FileSourcedConverter
public java.lang.String getFileDescription()
getFileDescription
in interface FileSourcedConverter
public void reset() throws java.io.IOException
reset
in interface Loader
reset
in class AbstractFileLoader
java.io.IOException
- if something goes wrongpublic void setSource(java.net.URL url) throws java.io.IOException
url
- the source url.
java.io.IOException
- if an error occurspublic java.io.File retrieveFile()
retrieveFile
in interface FileSourcedConverter
retrieveFile
in class AbstractFileLoader
public void setFile(java.io.File file) throws java.io.IOException
setFile
in interface FileSourcedConverter
setFile
in class AbstractFileLoader
file
- the source file
java.io.IOException
- if an error occurspublic void setURL(java.lang.String url) throws java.io.IOException
setURL
in interface URLSourcedLoader
url
- the url to load from
java.io.IOException
- if the url can't be set.public java.lang.String retrieveURL()
retrieveURL
in interface URLSourcedLoader
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-R Retain all string attribute values when reading incrementally.
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic void setRetainStringValues(boolean r)
r
- true if all string values are to be stored (as opposed to
just the current one).public boolean getRetainStringValues()
public java.lang.String retainStringValuesTipText()
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public void setSource(java.io.InputStream in) throws java.io.IOException
setSource
in interface Loader
setSource
in class AbstractLoader
in
- the source InputStream.
java.io.IOException
- always thrown.public Instances getStructure() throws java.io.IOException
getStructure
in interface Loader
getStructure
in class AbstractLoader
java.io.IOException
- if an error occurspublic 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(Instances structure) throws java.io.IOException
getNextInstance
in interface Loader
getNextInstance
in class AbstractLoader
structure
- the dataset header information, will get updated in
case of string or relational attributes
java.io.IOException
- if there is an error during parsingpublic java.lang.String getRevision()
getRevision
in interface RevisionHandler
public 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 |