SequenceCodec (Apache OpenNLP Tools 1.9.5 API)
Date: 2026-06-18

opennlp.tools.util

## Interface SequenceCodec<T>

- All Known Implementing Classes:
    BilouCodec, BioCodec

      public interface SequenceCodec<T>

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `areOutcomesCompatible(String[] outcomes)` Checks if the outcomes of the model are compatible with the codec.
    `SequenceValidator<T>` | `createSequenceValidator()` Creates a sequence validator which can validate a sequence of outcomes.
    `Span[]` | `decode(List<T> c)` Decodes a sequence T objects into Span objects.
    `T[]` | `encode(Span[] names, int length)` Encodes Span objects into a sequence of T objects.

- - ### Method Detail

    - #### decode

          Span[] decode(List<T> c)

      Decodes a sequence T objects into Span objects.
      Parameters:
        `c` -
      Returns:

    - #### encode

          T[] encode(Span[] names,
                     int length)

      Encodes Span objects into a sequence of T objects.
      Parameters:
        `names` -
        `length` -
      Returns:

    - #### createSequenceValidator

          SequenceValidator<T> createSequenceValidator()

      Creates a sequence validator which can validate a sequence of outcomes.
      Returns:

    - #### areOutcomesCompatible

          boolean areOutcomesCompatible(String[] outcomes)

      Checks if the outcomes of the model are compatible with the codec.
      Parameters:
        `outcomes` - all possible model outcomes
      Returns:

Copyright © 2026 The Apache Software Foundation. All rights reserved.