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

opennlp.tools.entitylinker

## Class LinkedSpan<T extends BaseLink>

- java.lang.Object
- - opennlp.tools.util.Span
  - - opennlp.tools.entitylinker.LinkedSpan<T>

- Type Parameters:
    `T` -
  All Implemented Interfaces:
    Serializable, Comparable<Span>

      public class LinkedSpan<T extends BaseLink>
      extends Span

  An "default" extended span that holds additional information about the Span
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LinkedSpan(ArrayList<T> linkedEntries, int s, int e)`
    `LinkedSpan(ArrayList<T> linkedEntries, int s, int e, String type)`
    `LinkedSpan(ArrayList<T> linkedEntries, int s, int e, String type, double prob)`
    `LinkedSpan(ArrayList<T> linkedEntries, Span span, int offset)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)` Checks if the specified span is equal to the current span.
    `ArrayList<T>` | `getLinkedEntries()` Returns the n best linked entries from an external data source.
    `String` | `getSearchTerm()` Returns the search term that was used to link this span to an external data source
    `int` | `getSentenceid()` Returns the id or index of the sentence from which this span was extracted
    `int` | `hashCode()` Generates a hash code of the current span.
    `void` | `setLinkedEntries(ArrayList<T> linkedEntries)` Sets the n best linked entries from an external data source.
    `void` | `setSearchTerm(String searchTerm)` sets the search term that is used to link this span to an external data source
    `void` | `setSentenceid(int sentenceid)` sets the id or index of the sentence from which this span was extracted
    `String` | `toString()` Generates a human readable string.

    - ### Methods inherited from class opennlp.tools.util.Span

      `compareTo, contains, contains, crosses, getCoveredText, getEnd, getProb, getStart, getType, intersects, length, spansToStrings, spansToStrings, startsWith, trim`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### LinkedSpan

          public LinkedSpan(ArrayList<T> linkedEntries,
                            int s,
                            int e,
                            String type)

    - #### LinkedSpan

          public LinkedSpan(ArrayList<T> linkedEntries,
                            int s,
                            int e,
                            String type,
                            double prob)

    - #### LinkedSpan

          public LinkedSpan(ArrayList<T> linkedEntries,
                            int s,
                            int e)

    - #### LinkedSpan

          public LinkedSpan(ArrayList<T> linkedEntries,
                            Span span,
                            int offset)

  - ### Method Detail

    - #### getLinkedEntries

          public ArrayList<T> getLinkedEntries()

      Returns the n best linked entries from an external data source. For instance, this will hold gazateer entries for a search into a geonames gazateer
      Returns:

    - #### setLinkedEntries

          public void setLinkedEntries(ArrayList<T> linkedEntries)

      Sets the n best linked entries from an external data source. For instance, this will hold gazateer entries for a search into a geonames gazateer

    - #### getSentenceid

          public int getSentenceid()

      Returns the id or index of the sentence from which this span was extracted
      Returns:

    - #### setSentenceid

          public void setSentenceid(int sentenceid)

      sets the id or index of the sentence from which this span was extracted
      Parameters:
        `sentenceid` -

    - #### getSearchTerm

          public String getSearchTerm()

      Returns the search term that was used to link this span to an external data source
      Returns:
        searchTerm

    - #### setSearchTerm

          public void setSearchTerm(String searchTerm)

      sets the search term that is used to link this span to an external data source
      Parameters:
        `searchTerm` -

    - #### toString

          public String toString()

      Description copied from class: `Span`
      Generates a human readable string.
      Overrides:
        `toString` in class `Span`

    - #### hashCode

          public int hashCode()

      Description copied from class: `Span`
      Generates a hash code of the current span.
      Overrides:
        `hashCode` in class `Span`

    - #### equals

          public boolean equals(Object obj)

      Description copied from class: `Span`
      Checks if the specified span is equal to the current span.
      Overrides:
        `equals` in class `Span`

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