edu.northwestern.at.morphadorner.tools.tcp

## Class CountDividedWords

- java.lang.Object
- - edu.northwestern.at.morphadorner.tools.tcp.CountDividedWords

-     public class CountDividedWords
      extends java.lang.Object

  Count words containing divider characters.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static int` | `currentFileNumber` Current document.
    `protected static java.util.Set<java.lang.String>` | `dividedWords` Tokens containing break marker.
    `protected static java.lang.String` | `dividedWordsFileName` Divided words file name.
    `protected static int` | `filesToProcess` Number of documents to process.
    `protected static int` | `INITPARAMS` # params before input file specs.
    `protected static java.util.regex.Matcher` | `partWordMatcher` Pattern to match partial word's word ID.
    `protected static java.io.PrintStream` | `printStream` Wrapper for printStream to allow utf-8 output.
    `protected static int` | `totalWords` Total words found.
    `protected static java.util.Map<java.lang.String,java.lang.Number>` | `wordsAndCounts` Tokens and counts.
    `protected static java.lang.String` | `wordsAndCountsFileName` Words and counts file name.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CountDividedWords()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static java.util.List<java.lang.String>` | `getWordPartIDs(AdornedWordsLoader adornedWordsLoader, java.lang.String wordID)` Get all word IDs for a split word.
    `protected static java.lang.String` | `getWordText(AdornedWordsLoader adornedWordsLoader, java.lang.String wordID)` Get word text.
    `protected static boolean` | `initialize(java.lang.String[] args)` Initialize.
    `protected static boolean` | `isFirstWordPart(java.lang.String wordID)` Is word first part of split word?
    `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 xmlFileName)` Process one 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

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

    - #### dividedWordsFileName

          protected static java.lang.String dividedWordsFileName

      Divided words file name.

    - #### wordsAndCountsFileName

          protected static java.lang.String wordsAndCountsFileName

      Words and counts file name.

    - #### printStream

          protected static java.io.PrintStream printStream

      Wrapper for printStream to allow utf-8 output.

    - #### wordsAndCounts

          protected static java.util.Map<java.lang.String,java.lang.Number> wordsAndCounts

      Tokens and counts.

    - #### dividedWords

          protected static java.util.Set<java.lang.String> dividedWords

      Tokens containing break marker.

    - #### partWordMatcher

          protected static java.util.regex.Matcher partWordMatcher

      Pattern to match partial word's word ID.

  - ### Constructor Detail

    - #### CountDividedWords

          public CountDividedWords()

  - ### 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 xmlFileName)

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

    - #### isFirstWordPart

          protected static boolean isFirstWordPart(java.lang.String wordID)

      Is word first part of split word?
      Parameters:
        `wordID` - Word ID of possibly split word part.
      Returns:
        True if word part first part of split word or only part of unsplit word.

    - #### getWordText

          protected static java.lang.String getWordText(AdornedWordsLoader adornedWordsLoader,
                                     java.lang.String wordID)

      Get word text.
      Parameters:
        `wordID` - Word ID of possibly split word.
      Returns:
        Word text. Word parts are joined together if the word is split

    - #### getWordPartIDs

          protected static java.util.List<java.lang.String> getWordPartIDs(AdornedWordsLoader adornedWordsLoader,
                                                        java.lang.String wordID)

      Get all word IDs for a split word.
      Parameters:
        `wordID` - Word ID of possibly split word.
      Returns:
        String list of word IDs for all parts of split word.

        If the word is not split, the result list contains the single word ID specified by the input value wordID.

    - #### processFiles

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

      Process files.
      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.