Class Orthography

java.lang.Object
ca.phon.orthography.Orthography
All Implemented Interfaces:
IExtendable, Visitable<OrthographyElement>, Iterable<OrthographyElement>

public final class Orthography extends Object implements Iterable<OrthographyElement>, Visitable<OrthographyElement>, IExtendable
Container for orthographic transcriptions. This class is immutable after being created. To append/modify the data in the Orthography, use the OrthographyBuilder class to create a modified Orthography instance. The parseOrthography method accepts Strings in the CHAT Transcription Format
  • Constructor Details

  • Method Details

    • parseOrthography

      public static Orthography parseOrthography(String text) throws ParseException
      Parse the given text into a new Orthography object.
      Throws:
      ParseException
    • getExtensions

      public Set<Class<?>> getExtensions()
      Description copied from interface: IExtendable
      Return all extension types supported
      Specified by:
      getExtensions in interface IExtendable
    • getExtension

      public <T> T getExtension(Class<T> cap)
      Description copied from interface: IExtendable
      Get the requested extension if available.
      Specified by:
      getExtension in interface IExtendable
      Returns:
      the capability object or null if the cability is not available
    • putExtension

      public <T> T putExtension(Class<T> cap, T impl)
      Description copied from interface: IExtendable
      Add a new extension.
      Specified by:
      putExtension in interface IExtendable
      Parameters:
      cap - the extension to add
      Returns:
      the added extension implementation
    • removeExtension

      public <T> T removeExtension(Class<T> cap)
      Description copied from interface: IExtendable
      Remove a capability.
      Specified by:
      removeExtension in interface IExtendable
      Parameters:
      cap - the capability to remove
    • accept

      public void accept(Visitor<OrthographyElement> visitor)
      Description copied from interface: Visitable
      Accept the given visitor.
      Specified by:
      accept in interface Visitable<OrthographyElement>
    • subsection

      public Orthography subsection(int start, int end)
      Return a new Orthography instance with the given range of elements
      Parameters:
      start -
      end -
      Returns:
    • length

      public int length()
    • elementAt

      public OrthographyElement elementAt(int idx)
    • indexOf

      public int indexOf(OrthographyElement ele)
      Get element index of the given element. This function does not recurse into groups or phonetic groups.
      Parameters:
      ele -
      Returns:
    • stringIndexOf

      public int stringIndexOf(OrthographyElement ele)
      Get the string index of the given element. This method will recurse into groups and phonetic groups
      Parameters:
      ele -
      Returns:
      string index or -1 element is not part of this Orthography instance
    • hasTerminator

      public boolean hasTerminator()
      Does utterance have a terminator?
      Returns:
      true if terminator found, false otherwise
    • getTerminator

      public Terminator getTerminator()
      Get terminator for utterance (if any.)
      Returns:
      utterance terminator or null if not found
    • hasUtteranceMedia

      public boolean hasUtteranceMedia()
      Does this utterance have a media segment after the terminator?
      Returns:
      true if this utterance has an internal-media segment after the terminator
    • getUtteranceMedia

      public InternalMedia getUtteranceMedia()
      Return the utterance internal-media element after terminator (if any)
      Returns:
      utterance media or null
    • getAnnotations

      public List<OrthographyAnnotation> getAnnotations()
      Return utterance level annotations. These annotations must appear after the terminator and postcodes. Utterance level annotations may include markers and errors.
      Returns:
      unmodifiable list of annotations at end of utterance
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toList

      public List<OrthographyElement> toList()
    • iterator

      public Iterator<OrthographyElement> iterator()
      Specified by:
      iterator in interface Iterable<OrthographyElement>