|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.ConfigurableProcessor
de.fu_berlin.ties.TextProcessor
de.fu_berlin.ties.eval.LineShuffleGenerator
public class LineShuffleGenerator
Randomly reshuffles the lines in a file (except for the first n lines, if configured).
Field Summary |
---|
Fields inherited from class de.fu_berlin.ties.TextProcessor |
---|
CONFIG_POST, KEY_DIRECTORY, KEY_LOCAL_NAME, KEY_OUT_DIRECTORY, KEY_URL |
Constructor Summary | |
---|---|
LineShuffleGenerator(String outExt)
Creates a new instance from the standard configuration. |
|
LineShuffleGenerator(String outExt,
int ignoredLines,
TiesConfiguration conf)
Creates a new instance. |
|
LineShuffleGenerator(String outExt,
TiesConfiguration conf)
Creates a new instance from the provided configuration. |
Method Summary | |
---|---|
protected void |
doProcess(Reader reader,
Writer writer,
ContextMap context)
Processes the contents of a reader, writing a modified version to a writer. This implementation delegates to the static shuffleLines(Reader, Writer, int) method, using the configured
number of lines to ignore. |
protected static void |
shuffleLines(Reader reader,
Writer writer,
int ignoreFirst)
Randomly reshuffles the lines in a file (except for the first ignoreFirst lines). |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class de.fu_berlin.ties.TextProcessor |
---|
getOutFileExt, process, process, process, process, process, process |
Methods inherited from class de.fu_berlin.ties.ConfigurableProcessor |
---|
getConfig |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LineShuffleGenerator(String outExt)
outExt
- the extension to use for output filespublic LineShuffleGenerator(String outExt, TiesConfiguration conf)
outExt
- the extension to use for output filesconf
- used to configure this instance; must not be
null
public LineShuffleGenerator(String outExt, int ignoredLines, TiesConfiguration conf)
outExt
- the extension to use for output filesignoredLines
- the number of lines at the start of a file that
should be ignored, if any; must be 0 or positiveconf
- passed to the superclass; if null
,
the standard configuration is usedMethod Detail |
---|
protected static void shuffleLines(Reader reader, Writer writer, int ignoreFirst) throws IllegalArgumentException, IOException
ignoreFirst
lines).
reader
- reader containing the text to process; not closed
by this methodwriter
- the writer to write the processed text to; flushed
but not closed by this methodignoreFirst
- the number of lines at the start of a file that
should be ignored, if any; must be 0 or positive
IllegalArgumentException
- if ignoreFirst
is negative
IOException
- if an I/O error occurs while reading or writingprotected void doProcess(Reader reader, Writer writer, ContextMap context) throws IOException
shuffleLines(Reader, Writer, int)
method, using the configured
number of lines to ignore.
doProcess
in class TextProcessor
reader
- reader containing the text to process; should not be closed
by this methodwriter
- the writer to write the processed text to; might be flushed
but not closed by this method; if this method does not use the writer,
the underlying file will be deleted afterwardscontext
- a map of objects that are made available for processing;
when called from the implemented process
methods in this
class, it will contain mappings from IOUtils.KEY_LOCAL_CHARSET
to the character set of the output writer;
from TextProcessor.KEY_OUT_DIRECTORY
to the output directory (File
);
from ContentType.KEY_MIME_TYPE
to the document's MIME type; from
TextProcessor.KEY_LOCAL_NAME
to the local name (String) and either from
TextProcessor.KEY_DIRECTORY
to the input directory (File
), in case of
a local file) or from TextProcessor.KEY_URL
to the URL
(otherwise) of
the processed document
IOException
- if an I/O error occurspublic String toString()
toString
in class TextProcessor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |