Package opennlp.tools.namefind
Class NameSample
- java.lang.Object
-
- opennlp.tools.namefind.NameSample
-
- All Implemented Interfaces:
java.io.Serializable
public class NameSample extends java.lang.Object implements java.io.Serializable
Class for holding names for a single unit of text.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_TYPE
The a default type value when there is no type in training data.
-
Constructor Summary
Constructors Constructor Description NameSample(java.lang.String[] sentence, Span[] names, boolean clearAdaptiveData)
NameSample(java.lang.String[] sentence, Span[] names, java.lang.String[][] additionalContext, boolean clearAdaptiveData)
Initializes the current instance.NameSample(java.lang.String id, java.lang.String[] sentence, Span[] names, java.lang.String[][] additionalContext, boolean clearAdaptiveData)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.String[][]
getAdditionalContext()
java.lang.String
getId()
Span[]
getNames()
java.lang.String[]
getSentence()
int
hashCode()
boolean
isClearAdaptiveDataSet()
static NameSample
parse(java.lang.String taggedTokens, boolean isClearAdaptiveData)
static NameSample
parse(java.lang.String taggedTokens, java.lang.String defaultType, boolean isClearAdaptiveData)
java.lang.String
toString()
-
-
-
Field Detail
-
DEFAULT_TYPE
public static final java.lang.String DEFAULT_TYPE
The a default type value when there is no type in training data.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NameSample
public NameSample(java.lang.String id, java.lang.String[] sentence, Span[] names, java.lang.String[][] additionalContext, boolean clearAdaptiveData)
-
NameSample
public NameSample(java.lang.String[] sentence, Span[] names, java.lang.String[][] additionalContext, boolean clearAdaptiveData)
Initializes the current instance.- Parameters:
sentence
- training sentencenames
-additionalContext
-clearAdaptiveData
- if true the adaptive data of the feature generators is cleared
-
NameSample
public NameSample(java.lang.String[] sentence, Span[] names, boolean clearAdaptiveData)
-
-
Method Detail
-
getId
public java.lang.String getId()
-
getSentence
public java.lang.String[] getSentence()
-
getNames
public Span[] getNames()
-
getAdditionalContext
public java.lang.String[][] getAdditionalContext()
-
isClearAdaptiveDataSet
public boolean isClearAdaptiveDataSet()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
parse
public static NameSample parse(java.lang.String taggedTokens, boolean isClearAdaptiveData) throws java.io.IOException
- Throws:
java.io.IOException
-
parse
public static NameSample parse(java.lang.String taggedTokens, java.lang.String defaultType, boolean isClearAdaptiveData) throws java.io.IOException
- Throws:
java.io.IOException
-
-