Package opennlp.tools.namefind

# Interface OffsetMappingNameFinder

All Superinterfaces:
  `TokenNameFinder`

public interface OffsetMappingNameFinder extends TokenNameFinder
A `TokenNameFinder` that can additionally report detected spans in the character coordinates of the original input, mapping back through any text normalization applied before detection.

An implementation that normalizes input before detection (for example an ONNX model that folds Unicode whitespace or dashes) returns spans from `TokenNameFinder.find(String[])` in the coordinates of the normalized text, which no longer line up with the caller's input when a fold changes the length. `findInOriginal(String[])` maps those spans back to original-input coordinates. This is a separate capability interface rather than a method on `TokenNameFinder` because the classic contract reports token-index spans, for which an original-character mapping is not meaningful; an interface-typed caller tests for the capability (`finder instanceof OffsetMappingNameFinder`) instead of depending on a concrete implementation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Span[]`
  `findInOriginal(String[] tokens)`
  Finds names and returns their `spans` in the character coordinates of the original input, regardless of any normalization applied before detection.

  ### Methods inherited from interface opennlp.tools.namefind.TokenNameFinder

  `clearAdaptiveData, find`

- ## Method Details

  - ### findInOriginal

    Span[] findInOriginal(String[] tokens)
    Finds names and returns their `spans` in the character coordinates of the original input, regardless of any normalization applied before detection.
    Parameters:
      `tokens` - The tokens to search.
    Returns:
      The detected spans, in original-input character coordinates.
    Throws:
      `IllegalArgumentException` - Thrown if `tokens` is `null` or contains a `null` token.