edu.northwestern.at.morphadorner.tools.adornedtosketch

## Class AdornedToSketch

- java.lang.Object
- - edu.northwestern.at.morphadorner.tools.adornedtosketch.AdornedToSketch

-     public class AdornedToSketch
      extends java.lang.Object

  Convert adorned file to input for Sketch or NoSketch engine.

  AdornedToSketch converts adorned TEI XML files to the verticalized format required as input to the Sketch or NoSketch corpus search engines.

  Usage:

  > `java edu.northwestern.at.morphadorner.tools.adornedtosketch.AdornedToSketch sketchinput.txt corpusname adorned1.xml adorned2.xml ...`

  where

  - sketchinput.txt specifies the output filename of the verticalized representation required for input to the Sketch or NoSketch engines.
  - corpusname specifies the corpus name to be used when creating the Sketch engine input.
  - adorned1.xml adorned2.xml ... specifies the input MorphAdorned XML files from which to produce the Sketch engine input.

  Known flaw: AdornedToSketch does not generate the "glue" elements which bind punctuation marks to word tokens. Searching the corpus still works fine in the Sketch or NoSketch engine, but the punctuation marks are displayed detached from any token to which they would normally be attached.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.lang.String` | `corpusName` Corpus name.
    `protected static int` | `currentDocNumber` Current document.
    `protected static int` | `docsToProcess` Number of documents to process.
    `protected static int` | `INITPARAMS` # params before input file specs.
    `protected static java.lang.String` | `inputDirectory` Input directory.
    `protected static java.lang.String` | `outputFile` Output file name.
    `protected static java.io.PrintStream` | `outputFileStream` Output file stream.
    `protected static java.io.PrintStream` | `printStream` Wrapper for printStream to allow utf-8 output.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AdornedToSketch()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 xmlFileName)` Process one file.
    `protected static java.lang.String[]` | `splitPath(java.lang.String path)` Split word path into separate tags.
    `protected static java.lang.String[]` | `splitPathFull(java.lang.String path)` Split word path into separate tags.
    `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

    - #### docsToProcess

          protected static int docsToProcess

      Number of documents to process.

    - #### currentDocNumber

          protected static int currentDocNumber

      Current document.

    - #### inputDirectory

          protected static java.lang.String inputDirectory

      Input directory.

    - #### outputFile

          protected static java.lang.String outputFile

      Output file name.

    - #### outputFileStream

          protected static java.io.PrintStream outputFileStream

      Output file stream.

    - #### printStream

          protected static java.io.PrintStream printStream

      Wrapper for printStream to allow utf-8 output.

    - #### corpusName

          protected static java.lang.String corpusName

      Corpus name.

    - #### INITPARAMS

          protected static final int INITPARAMS

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

  - ### Constructor Detail

    - #### AdornedToSketch

          public AdornedToSketch()

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

    - #### splitPathFull

          protected static java.lang.String[] splitPathFull(java.lang.String path)

      Split word path into separate tags.
      Parameters:
        `path` - The word path.
      Returns:
        String array of split XML tags. The trailing "w[]" element is removed.

    - #### splitPath

          protected static java.lang.String[] splitPath(java.lang.String path)

      Split word path into separate tags.
      Parameters:
        `path` - The word path.
      Returns:
        String array of split XML tags. Both the leading document name tag and the trailing word (w[]) tag are removed.

    - #### processOneFile

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

      Process one file.
      Parameters:
        `xmlFileName` - Adorned XML file name to reformat for CWB.

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