edu.northwestern.at.morphadorner.tools.sampletextfile

## Class RandomlySampleTextFile

- java.lang.Object
- - edu.northwestern.at.morphadorner.tools.sampletextfile.SampleTextFile
  - - edu.northwestern.at.morphadorner.tools.sampletextfile.RandomlySampleTextFile

-     public class RandomlySampleTextFile
      extends SampleTextFile

  Randomly sample a text file.

  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.

- - ### Field Summary

    - ### Fields inherited from class edu.northwestern.at.morphadorner.tools.sampletextfile.SampleTextFile

      `inputFileName, outputFileName, sample`

  - ### Constructor Summary

    Constructors
    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.

  - ### Method Summary

    Methods
    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.

    - ### Methods inherited from class edu.northwestern.at.morphadorner.tools.sampletextfile.SampleTextFile

      `sample, samplingDone, setupSampling`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RandomlySampleTextFile

          public RandomlySampleTextFile(java.lang.String inputFileName,
                                java.lang.String outputFileName,
                                double sample)

      Copy a text file to another while sampling the input lines.
      Parameters:
        `inputFileName` - Input file name.
        `outputFileName` - Output file name.
        `sample` - Sample count, percentage, etc.

  - ### Method Detail

    - #### main

          public static void main(java.lang.String[] args)

      Main program.
      Parameters:
        `args` - Program parameters.

    - #### help

          public static void help()

      Help text.

    - #### lineSelected

          protected boolean lineSelected(java.lang.String inputLine)

      Check if line should be selected.
      Specified by:
        `lineSelected` in class `SampleTextFile`
      Parameters:
        `inputLine` - The input line.
      Returns:
        true to select line.

        Subclasses must override this method.