edu.northwestern.at.morphadorner.tools.fixquotes

## Class FixXMLQuotes

- java.lang.Object
- - edu.northwestern.at.morphadorner.tools.fixquotes.FixXMLQuotes

-     public class FixXMLQuotes
      extends java.lang.Object

  Fix quotes in TEI XML files.

  Usage:

  >       java edu.northwestern.at.morphadorner.tools.fixquotes.FixXMLQuotes softtags.txt jumptags.txt outputdirectory input1.xml input2.xml ...

  softtags.txt -- text file containing list of soft XML tags, one per line.
  jumptags.txt -- text file containing list of jump XML tags, one per line.
  outputdirectory -- output directory to receive xml files with quotes fixed.
  input*.xml -- input TEI XML files.

  Since the "quotification" relies on heuristics, not all quotes will be converted correctly.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.lang.String` | `ap` Temporary apostrophe marker.
    `protected static java.lang.String` | `apos` Apostrophereplacement text.
    `protected static TaggedStrings` | `contractions` Contractions.
    `protected static java.util.regex.Matcher` | `contractionsMatcher` Pattern matcher for matching contractions.
    `protected static int` | `currentDocNumber` Current document.
    `protected static boolean` | `debug` True for debugging output.
    `protected static int` | `docsToProcess` Number of documents to process.
    `protected static org.w3c.dom.Document` | `document` DOM document.
    `protected static java.lang.String` | `dq` Temporary double quote marker.
    `protected static int` | `INITPARAMS` # params before input file specs.
    `protected static java.util.Set<java.lang.String>` | `jumpTags` Jump tags.
    `protected static java.lang.String` | `ldquo` Left double quote replacement text.
    `protected static java.lang.String` | `lsquo` Left single quote replacement text.
    `protected static java.lang.String` | `outputDirectory` Output directory.
    `protected static java.lang.String` | `prevChar` Previous character of last text segment.
    `protected static java.lang.String` | `rdquo` Right double quote replacement text.
    `protected static java.lang.String` | `rsquo` Right single quote replacement text.
    `protected static java.util.Set<java.lang.String>` | `softTags` Soft tags.
    `protected static java.lang.String` | `sq` Temporary single quote marker.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `FixXMLQuotes()` Allow overrides but not instantiation.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static boolean` | `initialize(java.lang.String[] args)` Initialize.
    `protected static boolean` | `isHardTag(java.lang.String tag)` Is tag a hard tag?
    `protected static boolean` | `isJumpTag(java.lang.String tag)` Is tag a jump tag?
    `protected static boolean` | `isSoftTag(java.lang.String tag)` Is tag a soft tag?
    `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.
    `protected static void` | `traverse(org.w3c.dom.Node node)` Traverse DOM tree and fix quotes.

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

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

- - ### Field Detail

    - #### document

          protected static org.w3c.dom.Document document

      DOM document.

    - #### INITPARAMS

          protected static final int INITPARAMS

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

    - #### docsToProcess

          protected static int docsToProcess

      Number of documents to process.

    - #### currentDocNumber

          protected static int currentDocNumber

      Current document.

    - #### outputDirectory

          protected static java.lang.String outputDirectory

      Output directory.

    - #### contractions

          protected static TaggedStrings contractions

      Contractions.

    - #### contractionsMatcher

          protected static java.util.regex.Matcher contractionsMatcher

      Pattern matcher for matching contractions.

    - #### lsquo

          protected static final java.lang.String lsquo

      Left single quote replacement text.
      See Also:
        Constant Field Values

    - #### ldquo

          protected static final java.lang.String ldquo

      Left double quote replacement text.
      See Also:
        Constant Field Values

    - #### rsquo

          protected static final java.lang.String rsquo

      Right single quote replacement text.
      See Also:
        Constant Field Values

    - #### rdquo

          protected static final java.lang.String rdquo

      Right double quote replacement text.
      See Also:
        Constant Field Values

    - #### apos

          protected static final java.lang.String apos

      Apostrophereplacement text.
      See Also:
        Constant Field Values

    - #### sq

          protected static final java.lang.String sq

      Temporary single quote marker.
      See Also:
        Constant Field Values

    - #### dq

          protected static final java.lang.String dq

      Temporary double quote marker.
      See Also:
        Constant Field Values

    - #### ap

          protected static final java.lang.String ap

      Temporary apostrophe marker.
      See Also:
        Constant Field Values

    - #### prevChar

          protected static java.lang.String prevChar

      Previous character of last text segment.

    - #### softTags

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

      Soft tags.

    - #### jumpTags

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

      Jump tags.

    - #### debug

          protected static boolean debug

      True for debugging output.

  - ### Constructor Detail

    - #### FixXMLQuotes

          protected FixXMLQuotes()

      Allow overrides but not instantiation.

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

      Initialize.

    - #### processOneFile

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

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

    - #### traverse

          protected static void traverse(org.w3c.dom.Node node)

      Traverse DOM tree and fix quotes.
      Parameters:
        `node` - Root node of tree.

    - #### processFiles

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

      Process files.

    - #### terminate

          protected static void terminate(int filesProcessed,
                       long processingTime)

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

    - #### isSoftTag

          protected static boolean isSoftTag(java.lang.String tag)

      Is tag a soft tag?
      Parameters:
        `tag` - The XML tag.
      Returns:
        true if tag is a soft tag.

    - #### isJumpTag

          protected static boolean isJumpTag(java.lang.String tag)

      Is tag a jump tag?
      Parameters:
        `tag` - The XML tag.
      Returns:
        true if tag is a jump tag.

    - #### isHardTag

          protected static boolean isHardTag(java.lang.String tag)

      Is tag a hard tag?
      Parameters:
        `tag` - The XML tag.
      Returns:
        true if tag is a hard tag.