Package opennlp.tools.postag
Class POSSample
- java.lang.Object
-
- opennlp.tools.postag.POSSample
-
- All Implemented Interfaces:
Serializable
,Sample
public class POSSample extends Object implements Sample
Represents an pos-taggedsentence
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description POSSample(String[] sentence, String[] tags)
Initializes aPOSSample
instance.POSSample(String[] sentence, String[] tags, String[][] additionalContext)
Initializes aPOSSample
instance.POSSample(List<String> sentence, List<String> tags)
Initializes aPOSSample
instance.POSSample(List<String> sentence, List<String> tags, String[][] additionalContext)
Initializes aPOSSample
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String[][]
getAdditionalContext()
String[]
getSentence()
String[]
getTags()
int
hashCode()
static POSSample
parse(String sentenceString)
Parses asentenceString
.String
toString()
-
-
-
Constructor Detail
-
POSSample
public POSSample(String[] sentence, String[] tags)
Initializes aPOSSample
instance.- Parameters:
sentence
- The sentence of tokens to be tagged.tags
- An array of pos tags for each token provided insentence
.
-
POSSample
public POSSample(List<String> sentence, List<String> tags)
Initializes aPOSSample
instance.- Parameters:
sentence
- The sentence to be tagged.tags
- AList
of pos tags for each token provided insentence
.
-
POSSample
public POSSample(List<String> sentence, List<String> tags, String[][] additionalContext)
Initializes aPOSSample
instance.- Parameters:
sentence
- The sentence to be tagged.tags
- AList
of pos tags for each token provided insentence
.additionalContext
- A 2D array which holds additional information for the context.
-
POSSample
public POSSample(String[] sentence, String[] tags, String[][] additionalContext)
Initializes aPOSSample
instance.- Parameters:
sentence
- The sentence to be tagged.tags
- An array of pos tags for each token provided insentence
.additionalContext
- A 2D array which holds additional information for the context.
-
-
Method Detail
-
getSentence
public String[] getSentence()
- Returns:
- Retrieves the sentence as array.
-
getTags
public String[] getTags()
- Returns:
- Retrieves the tags as array.
-
getAdditionalContext
public String[][] getAdditionalContext()
- Returns:
- Retrieves additional information for the context.
-
parse
public static POSSample parse(String sentenceString) throws InvalidFormatException
Parses asentenceString
.- Parameters:
sentenceString
- The sentence to be parsed.- Returns:
- A valid
POSSample
result. - Throws:
InvalidFormatException
- Thrown if errors occurred during parsing.
-
-