edu.northwestern.at.morphadorner.corpuslinguistics.inputter

## Interface TextInputter

- All Known Implementing Classes:
    CompressedXMLTextInputter, DefaultTextInputter, DiskBasedXMLTextInputter, FirstTokenURLTextInputter, SimpleXMLTextInputter, URLTextInputter, XMLTextInputter

      public interface TextInputter

  Interface for retrieving text from a possibly segmented input source.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `enableGapFixer(boolean fixGaps)` Enable gap element fixer.
    `void` | `enableOrigFixer(boolean fixOrigs)` Enable orig element fixer.
    `void` | `enableSplitWordsFixer(boolean fixSplitWords, java.util.List<PatternReplacer> patternReplacers)` Enable split words fixer.
    `int` | `getSegmentCount()` Returns number of text segments.
    `java.lang.String` | `getSegmentName(int segmentNumber)` Returns name of specified segment.
    `java.lang.String` | `getSegmentText(int segmentNumber)` Returns specified segment of loaded text.
    `java.lang.String` | `getSegmentText(java.lang.String segmentName)` Returns specified segment of loaded text.
    `void` | `loadText(java.lang.String str)` Reads text from a String.
    `void` | `loadText(java.lang.String str, java.lang.String xmlSchemaURI)` Reads text from a string using a specified XML schema.
    `void` | `loadText(java.net.URL url, java.lang.String encoding)` Reads text from a URL.
    `void` | `loadText(java.net.URL url, java.lang.String encoding, java.lang.String xmlSchemaURI)` Reads text from a URL using a specified XML schema.
    `void` | `setSegmentText(int segmentNumber, java.io.File segmentTextFile)` Updates specified segment of loaded text from file.
    `void` | `setSegmentText(int segmentNumber, java.lang.String segmentText)` Updates specified segment of loaded text.
    `void` | `setSegmentText(java.lang.String segmentName, java.io.File segmentTextFile)` Returns specified segment of loaded text.
    `void` | `setSegmentText(java.lang.String segmentName, java.lang.String segmentText)` Returns specified segment of loaded text.
    `boolean` | `usesSegmentFiles()` Does inputter use segment files?

- - ### Method Detail

    - #### loadText

          void loadText(java.net.URL url,
                      java.lang.String encoding)
                        throws java.lang.Exception

      Reads text from a URL.
      Parameters:
        `url` - URL from which to read text.
        `encoding` - Text encoding.
      Throws:
        `java.io.IOException` - If an error occurs.
        `java.lang.Exception`

    - #### loadText

          void loadText(java.lang.String str)
                        throws java.lang.Exception

      Reads text from a String.
      Parameters:
        `str` - String from which to read text.
      Throws:
        `java.io.IOException` - If an error occurs.
        `java.lang.Exception`

    - #### loadText

          void loadText(java.net.URL url,
                      java.lang.String encoding,
                      java.lang.String xmlSchemaURI)
                        throws java.lang.Exception

      Reads text from a URL using a specified XML schema.
      Parameters:
        `url` - URL from which to read text.
        `encoding` - Text encoding.
        `xmlSchemaURI` - String URI specifying Xml schema.
      Throws:
        `java.lang.Exception` - If an error occurs.

        The schema and schema type should be ignored when the input is not an XML file.

    - #### loadText

          void loadText(java.lang.String str,
                      java.lang.String xmlSchemaURI)
                        throws java.lang.Exception

      Reads text from a string using a specified XML schema.
      Parameters:
        `str` - String from which to read text.
        `xmlSchemaURI` - String URI specifying Xml schema.
      Throws:
        `java.lang.Exception` - If an error occurs.

        The schema and schema type should be ignored when the input is not an XML file.

    - #### getSegmentCount

          int getSegmentCount()

      Returns number of text segments.
      Returns:
        Number of text segments.

    - #### getSegmentName

          java.lang.String getSegmentName(int segmentNumber)

      Returns name of specified segment.
      Parameters:
        `segmentNumber` - The segment number (starts at 0).
      Returns:
        The name for the specified segment number, or null if the segment number is invalid.

    - #### getSegmentText

          java.lang.String getSegmentText(int segmentNumber)

      Returns specified segment of loaded text.
      Parameters:
        `segmentNumber` - The segment number (starts at 0).
      Returns:
        The text for for the specified segment number, or null if the segment number is invalid. The returned text may be an empty string if the segment number is valid but the segment contains no text.

    - #### getSegmentText

          java.lang.String getSegmentText(java.lang.String segmentName)

      Returns specified segment of loaded text.
      Parameters:
        `segmentName` - The segment name.
      Returns:
        The text for for the specified segment name, or null if the segment name is invalid. The returned text may be an empty string if the segment name is valid but the segment contains no text.

    - #### setSegmentText

          void setSegmentText(int segmentNumber,
                            java.lang.String segmentText)

      Updates specified segment of loaded text.
      Parameters:
        `segmentNumber` - The segment number (starts at 0).
        `segmentText` - The updated segment text.

    - #### setSegmentText

          void setSegmentText(java.lang.String segmentName,
                            java.lang.String segmentText)

      Returns specified segment of loaded text.
      Parameters:
        `segmentName` - The segment name.
        `segmentText` - The updated segment text.

    - #### setSegmentText

          void setSegmentText(int segmentNumber,
                            java.io.File segmentTextFile)

      Updates specified segment of loaded text from file.
      Parameters:
        `segmentNumber` - The segment number (starts at 0).
        `segmentTextFile` - The file containing the updated segment text.

    - #### setSegmentText

          void setSegmentText(java.lang.String segmentName,
                            java.io.File segmentTextFile)

      Returns specified segment of loaded text.
      Parameters:
        `segmentName` - The segment name.
        `segmentTextFile` - The file containing the updated segment text.

    - #### enableGapFixer

          void enableGapFixer(boolean fixGaps)

      Enable gap element fixer.
      Parameters:
        `fixGaps` - true to fix gap tags.

    - #### enableOrigFixer

          void enableOrigFixer(boolean fixOrigs)

      Enable orig element fixer.
      Parameters:
        `fixOrigs` - true to fix orig tags.

    - #### enableSplitWordsFixer

          void enableSplitWordsFixer(boolean fixSplitWords,
                                   java.util.List<PatternReplacer> patternReplacers)

      Enable split words fixer.
      Parameters:
        `fixSplitWords` - true to fix selected split words.
        `patternReplacers` - Patterns for fixing split words.

    - #### usesSegmentFiles

          boolean usesSegmentFiles()

      Does inputter use segment files?
      Returns:
        true if inputter uses segment files.