public class RandomlySampleTextFile extends SampleTextFile
Usage:
java edu.northwestern.at.morphadorner.tools.sampletextfile.RandomlySampleTextFile input.txt output.txt samplingpercent
input.txt -- input text file to be sampled.
output.txt -- output text file.
samplingpercent -- sampling percent from 0 through 100.
The output file is a text file containing the sampled text lines from the input file. Both the input and the output must be utf-8 encoded. The output lines are appended to any existing lines in the output file.
inputFileName, outputFileName, sample| Constructor and Description |
|---|
RandomlySampleTextFile(java.lang.String inputFileName,
java.lang.String outputFileName,
double sample)
Copy a text file to another while sampling the input lines.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
help()
Help text.
|
protected boolean |
lineSelected(java.lang.String inputLine)
Check if line should be selected.
|
static void |
main(java.lang.String[] args)
Main program.
|
sample, samplingDone, setupSamplingpublic RandomlySampleTextFile(java.lang.String inputFileName,
java.lang.String outputFileName,
double sample)
inputFileName - Input file name.outputFileName - Output file name.sample - Sample count, percentage, etc.public static void main(java.lang.String[] args)
args - Program parameters.public static void help()
protected boolean lineSelected(java.lang.String inputLine)
lineSelected in class SampleTextFileinputLine - The input line.Subclasses must override this method.