Klasse NameSample

java.lang.Object
opennlp.tools.namefind.NameSample
Alle implementierten Schnittstellen:
Serializable, Sample

public class NameSample extends Object implements Sample
Encapsulates names for a single unit of text.
Siehe auch:
  • Felddetails

    • DEFAULT_TYPE

      public static final String DEFAULT_TYPE
      The default type value when there is no type in training data.
      Siehe auch:
  • Konstruktordetails

    • NameSample

      public NameSample(String id, String[] sentence, Span[] names, String[][] additionalContext, boolean clearAdaptiveData)
      Initializes a NameSample instance with given parameters.
      Parameter:
      id - The identifier to use.
      sentence - The tokens representing a training sentence. Must not be null.
      names - The names to use.
      additionalContext - Additional context in a 2-dimensional array.
      clearAdaptiveData - If true the adaptive data of the feature generators is cleared.
      Löst aus:
      RuntimeException - Thrown if name spans are overlapping.
    • NameSample

      public NameSample(String[] sentence, Span[] names, String[][] additionalContext, boolean clearAdaptiveData)
      Initializes a NameSample instance with given parameters.
      Parameter:
      sentence - The tokens representing a sentence. Must not be null.
      names - The names to use.
      additionalContext - Additional context in a 2-dimensional array.
      clearAdaptiveData - If true the adaptive data of the feature generators is cleared.
      Löst aus:
      RuntimeException - Thrown if name spans are overlapping.
    • NameSample

      public NameSample(String[] sentence, Span[] names, boolean clearAdaptiveData)
      Initializes a NameSample instance with given parameters.
      Parameter:
      sentence - The tokens representing a sentence. Must not be null.
      names - The names to use.
      clearAdaptiveData - If true the adaptive data of the feature generators is cleared.
      Löst aus:
      RuntimeException - Thrown if name spans are overlapping.
  • Methodendetails

    • getId

      public String getId()
      Gibt zurück:
      Retrieves the current identifier. May be null.
    • getSentence

      public String[] getSentence()
      Gibt zurück:
      Retrieves the sentence in tokenized form.
    • getNames

      public Span[] getNames()
      Gibt zurück:
      Retrieves the names.
    • getAdditionalContext

      public String[][] getAdditionalContext()
      Gibt zurück:
      Retrieves additional context. May be null.
    • isClearAdaptiveDataSet

      public boolean isClearAdaptiveDataSet()
      Gibt zurück:
      true if the adaptive data of the feature generators are cleared, false otherwise.
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • equals

      public boolean equals(Object obj)
      Setzt außer Kraft:
      equals in Klasse Object
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • parse

      public static NameSample parse(String taggedTokens, boolean clearAdaptiveData) throws IOException
      Parses given input into a NameSample.
      Parameter:
      taggedTokens - The input data to parse.
      clearAdaptiveData - true if the adaptive data of the feature generators should be cleared, false otherwise.
      Gibt zurück:
      A NameSample instance resulting from the parsing.
      Löst aus:
      IOException - Thrown if IO errors occurred during parsing.
    • parse

      public static NameSample parse(String taggedTokens, String defaultType, boolean clearAdaptiveData) throws IOException
      Parses given input into a NameSample.
      Parameter:
      taggedTokens - The input data to parse.
      defaultType - The type to set by default.
      clearAdaptiveData - true if the adaptive data of the feature generators should be cleared, false otherwise.
      Gibt zurück:
      A NameSample instance resulting from the parsing.
      Löst aus:
      IOException - Thrown if IO errors occurred during parsing.