public class TextDirectoryLoader extends AbstractLoader implements BatchConverter, IncrementalConverter, OptionHandler
-D Enables debug output. (default: off)
-F Stores the filename in an additional attribute. (default: off)
-dir <directory> The directory to work on. (default: current directory)
-charset <charset name> The character set to use, e.g UTF-8. (default: use the default character set)
-R Retain all string attribute values when reading incrementally.Based on code from the TextDirectoryToArff tool:
Loader,
Serialized FormLoader.StructureNotReadyExceptionBATCH, INCREMENTAL, NONE| Constructor and Description |
|---|
TextDirectoryLoader()
default constructor
|
| Modifier and Type | Method and Description |
|---|---|
String |
charSetTipText()
the tip text for this property
|
String |
debugTipText()
the tip text for this property
|
String |
getCharSet()
Get the character set to use when reading text files.
|
Instances |
getDataSet()
Return the full data set.
|
boolean |
getDebug()
Gets whether additional debug information is printed.
|
File |
getDirectory()
get the Dir specified as the source
|
String |
getFileDescription()
Returns a description of the file type, actually it's directories.
|
Instance |
getNextInstance(Instances structure)
TextDirectoryLoader is unable to process a data set incrementally.
|
String[] |
getOptions()
Gets the setting
|
boolean |
getOutputFilename()
Gets whether the filename will be stored as an extra attribute.
|
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.
|
String |
globalInfo()
Returns a string describing this loader
|
Enumeration<Option> |
listOptions()
Lists the available options
|
static void |
main(String[] args)
Main method.
|
String |
outputFilenameTipText()
the tip text for this property
|
void |
reset()
Resets the loader ready to read a new data set
|
void |
setCharSet(String charSet)
Set the character set to use when reading text files (an empty string
indicates that the default character set will be used).
|
void |
setDebug(boolean value)
Sets whether to print some debug information.
|
void |
setDirectory(File dir)
sets the source directory
|
void |
setOptions(String[] options)
Parses a given list of options.
|
void |
setOutputFilename(boolean value)
Sets whether the filename will be stored as an extra attribute.
|
void |
setSource(File dir)
Resets the Loader object and sets the source of the data set to be the
supplied File object.
|
setRetrieval, setSourcepublic String globalInfo()
public Enumeration<Option> listOptions()
listOptions in interface OptionHandlerpublic void setOptions(String[] options) throws Exception
-D Enables debug output. (default: off)
-F Stores the filename in an additional attribute. (default: off)
-dir <directory> The directory to work on. (default: current directory)
-charset <charset name> The character set to use, e.g UTF-8. (default: use the default character set)
setOptions in interface OptionHandleroptions - the optionsException - if options cannot be setpublic String[] getOptions()
getOptions in interface OptionHandlerpublic String charSetTipText()
public void setCharSet(String charSet)
charSet - the character set to use.public String getCharSet()
public void setDebug(boolean value)
value - if true additional debug information will be printed.public boolean getDebug()
public String debugTipText()
public void setOutputFilename(boolean value)
value - if true the filename will be stored in an extra attributepublic boolean getOutputFilename()
public String outputFilenameTipText()
public String getFileDescription()
public File getDirectory()
public void setDirectory(File dir) throws IOException
dir - the source directoryIOException - if an error occurspublic void reset()
reset in interface Loaderreset in class AbstractLoaderpublic void setSource(File dir) throws IOException
setSource in interface LoadersetSource in class AbstractLoaderdir - the source directory.IOException - if an error occurspublic Instances getStructure() throws IOException
getStructure in interface LoadergetStructure in class AbstractLoaderIOException - if an error occurspublic Instances getDataSet() throws IOException
getDataSet in interface LoadergetDataSet in class AbstractLoaderIOException - if there is no source or parsing failspublic Instance getNextInstance(Instances structure) throws IOException
getNextInstance in interface LoadergetNextInstance in class AbstractLoaderstructure - ignoredIOException - always. TextDirectoryLoader is unable to process a data
set incrementally.public String getRevision()
getRevision in interface RevisionHandlerpublic static void main(String[] args)
args - should contain the name of an input file.Copyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.