mark.nlp.data
Class TextInstance

java.lang.Object
  |
  +--mark.nlp.data.Instance
        |
        +--mark.nlp.data.TextInstance

public class TextInstance
extends Instance

An instance that contains text. The class follows the Immutable design pattern.


Constructor Summary
TextInstance(int category, java.io.File file)
          Initializes the text instance.
TextInstance(int category, java.lang.String text)
          Initializes the text instance.
 
Method Summary
static TextInstance[] extract(ArgHelper args, boolean required, java.lang.String prefix, java.io.FileFilter ff, FileCategorySet catSet, boolean shuffle)
          Extracts from a set of text files from a mark.core.args.ArgHelper a set of text instances.
 java.lang.String text()
          Returns the text instance's text.
 
Methods inherited from class mark.nlp.data.Instance
category, setCategory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextInstance

public TextInstance(int category,
                    java.lang.String text)
Initializes the text instance.

Parameters:
category - the instance's category.
text - the instance's text.

TextInstance

public TextInstance(int category,
                    java.io.File file)
             throws java.lang.Exception
Initializes the text instance.

Parameters:
category - the instance's category.
file - the text file from which to obatain the text.
Method Detail

text

public java.lang.String text()
Returns the text instance's text.

Returns:
the text.

extract

public static TextInstance[] extract(ArgHelper args,
                                     boolean required,
                                     java.lang.String prefix,
                                     java.io.FileFilter ff,
                                     FileCategorySet catSet,
                                     boolean shuffle)
                              throws java.lang.Exception
Extracts from a set of text files from a mark.core.args.ArgHelper a set of text instances. The format of the command line is the same as that used by mark.core.args.ArgUtil.extractFileSet.

Parameters:
args - the ArgHelper.
required - whether the argument is required.
prefix - the name of the argument (if more than one of same type).
ff - the file filter.
catSet - the category set which determines the category of each instance.
shuffle - if true, then shuffles the list before returning it.
Returns:
an array with the text file instances.
Throws:
java.lang.Exception - if there is no file set and required.
See Also:
ArgUtil.extractFileSet(mark.core.args.ArgHelper, boolean, java.lang.String, java.io.FileFilter)