Package opennlp.tools.util

# Interface SequenceCodec<T>

Type Parameters:
  `T` - The generic type for the elements to handle.

All Known Implementing Classes:
  `BilouCodec`, `BioCodec`

public interface SequenceCodec<T>
A codec for sequences of type `SequenceCodec`. Defines methods to en- or decode, and validate.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `DEFAULT_PREFIX`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `areOutcomesCompatible(String[] outcomes)`
  Checks if the `outcomes` of a model are compatible with this `SequenceCodec`.
  `SequenceValidator<T>`
  `createSequenceValidator()`
  `Span[]`
  `decode(List<T> c)`
  Decodes a sequence of `objects` into `Span` objects.
  `T[]`
  `encode(Span[] names, int length)`
  Encodes `Span` objects into a sequence of `objects`.

- ## Field Details

  - ### DEFAULT_PREFIX

    static final String DEFAULT_PREFIX
    See Also:
      - Constant Field Values

- ## Method Details

  - ### decode

    Span[] decode(List<T> c)
    Decodes a sequence of `objects` into `Span` objects.
    Parameters:
      `c` - A list of `SequenceCodec` to decode.
    Returns:
      A `Span` array encapsulating the decoded elements in `c`.

  - ### encode

    T[] encode(Span[] names, int length)
    Encodes `Span` objects into a sequence of `objects`.
    Parameters:
      `names` - A list of `elements` to encode.
      `length` - The length to respect.
    Returns:
      An array of `SequenceCodec` to encode.

  - ### createSequenceValidator

    SequenceValidator<T> createSequenceValidator()
    Returns:
      A `SequenceValidator` which can validate a sequence of `outcomes`.

  - ### areOutcomesCompatible

    boolean areOutcomesCompatible(String[] outcomes)
    Checks if the `outcomes` of a model are compatible with this `SequenceCodec`.
    Parameters:
      `outcomes` - The possible model outcomes.
    Returns:
      `true` if `outcomes` are type compatible, `false` otherwise.