Package opennlp.tools.entitylinker

# Class LinkedSpan<T extends BaseLink>

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

Type Parameters:
  `T` - The generic type that specializes a `BaseLink`.

All Implemented Interfaces:
  `Serializable`, `Comparable<Span>`

public class LinkedSpan<T extends BaseLink> extends Span
A default, extended `Span` that holds additional information about a `Span`.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LinkedSpan(ArrayList<T> linkedEntries, int s, int e)`
  Initializes a new `LinkedSpan`.
  `LinkedSpan(ArrayList<T> linkedEntries, int s, int e, String type)`
  Initializes a new `LinkedSpan`.
  `LinkedSpan(ArrayList<T> linkedEntries, int s, int e, String type, double prob)`
  Initializes a new `LinkedSpan`.
  `LinkedSpan(ArrayList<T> linkedEntries, Span span, int offset)`
  Initializes a new `LinkedSpan` via an existing `Span` which is shifted by the specified `offset`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `ArrayList<T>`
  `getLinkedEntries()`
  `String`
  `getSearchTerm()`
  `int`
  `getSentenceid()`
  `int`
  `hashCode()`
  `void`
  `setLinkedEntries(ArrayList<T> linkedEntries)`
  `void`
  `setSearchTerm(String searchTerm)`
  `void`
  `setSentenceid(int sentenceid)`
  `String`
  `toString()`

  ### 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 Details

  - ### LinkedSpan

    public LinkedSpan(ArrayList<T> linkedEntries, int s, int e, String type)
    Initializes a new `LinkedSpan`. Sets the prob to `0` as default.
    Parameters:
      `linkedEntries` - The `n` best linked entries from an external data source.
      `s` - The start position of a `Span`. Must be equal to or greater than `0`. Must not be greater than `e`.
      `e` - The end position of a `Span`, which is `+1` more than the last element in the span. Must be equal to or greater than `0`.
      `type` - The type of the span.
    Throws:
      `IllegalArgumentException` - Thrown if given parameters are invalid.

  - ### LinkedSpan

    public LinkedSpan(ArrayList<T> linkedEntries, int s, int e, String type, double prob)
    Initializes a new `LinkedSpan`.
    Parameters:
      `linkedEntries` - The `n` best linked entries from an external data source.
      `s` - The start position of a `Span`. Must be equal to or greater than `0`. Must not be greater than `e`.
      `e` - The end position of a `Span`, which is `+1` more than the last element in the span. Must be equal to or greater than `0`.
      `type` - The type of the span.
      `prob` - The probability of the `Span`.
    Throws:
      `IllegalArgumentException` - Thrown if given parameters are invalid.

  - ### LinkedSpan

    public LinkedSpan(ArrayList<T> linkedEntries, int s, int e)
    Initializes a new `LinkedSpan`.
    Parameters:
      `linkedEntries` - The `n` best linked entries from an external data source.
      `s` - The start position of a `Span`. Must be equal to or greater than `0`. Must not be greater than `e`.
      `e` - The end position of a `Span`, which is `+1` more than the last element in the span. Must be equal to or greater than `0`.
    Throws:
      `IllegalArgumentException` - Thrown if given parameters are invalid.

  - ### LinkedSpan

    public LinkedSpan(ArrayList<T> linkedEntries, Span span, int offset)
    Initializes a new `LinkedSpan` via an existing `Span` which is shifted by the specified `offset`.
    Parameters:
      `linkedEntries` - The `n` best linked entries from an external data source.
      `span` - The existing `Span`.
      `offset` - The positive or negative shift offset.
    Throws:
      `IllegalArgumentException` - Thrown if given parameters are invalid.

- ## Method Details

  - ### getLinkedEntries

    public ArrayList<T> getLinkedEntries()
    Returns:
      Retrieves the `n` best linked entries from an external data source. For instance, this will hold gazetteer entries for a search into a geonames gazetteer.

  - ### setLinkedEntries

    public void setLinkedEntries(ArrayList<T> linkedEntries)
    Parameters:
      `linkedEntries` - The `n` best linked entries from an external data source. For instance, this will hold gazetteer entries for a search into a geonames gazetteer.

  - ### getSentenceid

    public int getSentenceid()
    Returns:
      Retrieves the id or index of the sentence from which this span was extracted.

  - ### setSentenceid

    public void setSentenceid(int sentenceid)
    Parameters:
      `sentenceid` - The id or index of the sentence from which this span was extracted.

  - ### getSearchTerm

    public String getSearchTerm()
    Returns:
      Retrieves the search term that was used to link this span to an external data source.

  - ### setSearchTerm

    public void setSearchTerm(String searchTerm)
    Parameters:
      `searchTerm` - The search term that is used to link this span to an external data source.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Span`
    Returns:
      A human-readable representation of this `Span`.

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Span`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Span`