edu.northwestern.at.morphadorner.tools.countadornedwords

## Class CountAdornedWords

- java.lang.Object
- - edu.northwestern.at.morphadorner.tools.countadornedwords.CountAdornedWords

-     public class CountAdornedWords
      extends java.lang.Object

  Tabulate counts of adorned words from XMLToTab output files.

  Usage:

  java edu.northwestern.at.morphadorner.tools.countadornedwords.CountAdornedWords output.tab input.tab input2.tab ...
  outputdir -- output directory to receive tab-separated values files described below, one for each input file.
  input*.tab -- input tabbed files produced as output by XMLToTab.

  Each output file is a tab-delimited utf-8 text file containing the following fields, in order.

  1. Short work name, formed from input file name by stripping the path and file extension.
  2. The corrected original spelling.
  3. The standard spelling.
  4. The parts of speech.
  5. The lemmata.
  6. The count of the tuple (work name, corrected spelling, standard spelling, parts of speech, lemmata).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.util.Map<AdornedWordCountInfo,java.lang.Integer>` | `adornedWordInfoMap` Adorned word info map.
    `protected static int` | `currentFileNumber` Current document.
    `protected static int` | `DIVTYPE`
    `protected static int` | `filesToProcess` Number of documents to process.
    `protected static int` | `INITPARAMS` # params before input file specs.
    `protected static int` | `LEMMA`
    `protected static java.lang.String` | `outputDirectory` Output directory.
    `protected static int` | `PATH`
    `protected static int` | `POS`
    `protected static int` | `SPELLING`
    `protected static int` | `STANDARD`
    `protected static TEITagClassifier` | `tagClassifier` TEI tag classifier.
    `protected static int` | `totalWords` Total words found.
    `protected static int` | `uniqueWords` Count of document tags.
    `protected static int` | `WORKID` Tabular data input fields.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CountAdornedWords()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `incrementWordCountMap(AdornedWordCountInfo adornedWordInfo)` Updates counts for an adorned word in a set.
    `protected static boolean` | `initialize(java.lang.String[] args)` Initialize.
    `static void` | `main(java.lang.String[] args)` Main program.
    `protected static int` | `processFiles(java.lang.String[] args)` Process files.
    `protected static void` | `processOneFile(java.lang.String tabFileName)` Process one file.
    `static void` | `saveWordInfo(java.io.File adornedWordInfoFile, java.lang.String encoding)` Save adorned word count information to a file.
    `protected static void` | `terminate(int filesProcessed, long processingTime)` Terminate.

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

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

- - ### Field Detail

    - #### WORKID

          protected static final int WORKID

      Tabular data input fields.
      See Also:
        Constant Field Values

    - #### SPELLING

          protected static final int SPELLING

      See Also:
        Constant Field Values

    - #### STANDARD

          protected static final int STANDARD

      See Also:
        Constant Field Values

    - #### LEMMA

          protected static final int LEMMA

      See Also:
        Constant Field Values

    - #### POS

          protected static final int POS

      See Also:
        Constant Field Values

    - #### PATH

          protected static final int PATH

      See Also:
        Constant Field Values

    - #### DIVTYPE

          protected static final int DIVTYPE

      See Also:
        Constant Field Values

    - #### adornedWordInfoMap

          protected static java.util.Map<AdornedWordCountInfo,java.lang.Integer> adornedWordInfoMap

      Adorned word info map.

    - #### outputDirectory

          protected static java.lang.String outputDirectory

      Output directory.

    - #### INITPARAMS

          protected static final int INITPARAMS

      # params before input file specs.
      See Also:
        Constant Field Values

    - #### filesToProcess

          protected static int filesToProcess

      Number of documents to process.

    - #### currentFileNumber

          protected static int currentFileNumber

      Current document.

    - #### totalWords

          protected static int totalWords

      Total words found.

    - #### uniqueWords

          protected static int uniqueWords

      Count of document tags.

    - #### tagClassifier

          protected static TEITagClassifier tagClassifier

      TEI tag classifier.

  - ### Constructor Detail

    - #### CountAdornedWords

          public CountAdornedWords()

  - ### Method Detail

    - #### main

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

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

    - #### initialize

          protected static boolean initialize(java.lang.String[] args)
                                       throws java.lang.Exception

      Initialize.
      Throws:
        `java.lang.Exception`

    - #### processOneFile

          protected static void processOneFile(java.lang.String tabFileName)

      Process one file.
      Parameters:
        `tabFileName` - XML input file name.

    - #### processFiles

          protected static int processFiles(java.lang.String[] args)
                                     throws java.lang.Exception

      Process files.
      Parameters:
        `args` - Program arguments.
      Throws:
        `java.lang.Exception`

    - #### terminate

          protected static void terminate(int filesProcessed,
                       long processingTime)

      Terminate.
      Parameters:
        `filesProcessed` - Number of files processed.
        `processingTime` - Processing time in seconds.

    - #### incrementWordCountMap

          public static void incrementWordCountMap(AdornedWordCountInfo adornedWordInfo)

      Updates counts for an adorned word in a set.
      Parameters:
        `adornedWordInfo` - The adorned word information.

    - #### saveWordInfo

          public static void saveWordInfo(java.io.File adornedWordInfoFile,
                          java.lang.String encoding)
                                   throws java.io.IOException,
                                          java.io.FileNotFoundException

      Save adorned word count information to a file.
      Parameters:
        `adornedWordInfoFile` - Output file name.
        `encoding` - Character encoding for the file.
      Throws:
        `java.io.IOException` - If output file has error.
        `java.io.FileNotFoundException`