Class POSTagFormatMapper
java.lang.Object
opennlp.tools.postag.POSTagFormatMapper
- Direct Known Subclasses:
POSTagFormatMapper.NoOp
A mapping implementation for converting between different POS tag formats.
This class supports conversion between Penn Treebank (PENN) and Universal Dependencies (UD) formats.
The conversion is based on the Universal Dependencies conversion table.
Please note that when converting from UD to Penn format, there may be ambiguity in some cases.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final POSTagFormat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertTag(String tag) Converts a given tag to the specified format.String[]convertTags(List<String> tags) Converts a list of tags to the specified format.static POSTagFormatguessFormat(POSModel posModel) Guesses thePOSTagFormatof a givenPOSModelprivate POSTagFormatguessModelTagFormat(String[] outcomes) Guesses thePOSTagFormatby using majority quorum.
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
CONVERSION_TABLE_PENN_TO_UD
-
CONVERSION_TABLE_UD_TO_PENN
-
modelFormat
-
-
Constructor Details
-
POSTagFormatMapper
-
-
Method Details
-
convertTags
Converts a list of tags to the specified format.- Parameters:
tags- a list of tags to be converted.- Returns:
- an array containing the converted tags with the same order and size as the given input list.
Note: A given tag might be
?if no mapping for the giventagcould be found.
-
convertTag
-
getGuessedFormat
- Returns:
- The guessed
POSTagFormat. Guaranteed to be notnull.
-
guessModelTagFormat
Guesses thePOSTagFormatby using majority quorum.- Parameters:
outcomes- must not benull.- Returns:
- the guessed
POSTagFormat. If the given input was empty,POSTagFormat.UNKNOWNis returned.
-
guessFormat
Guesses thePOSTagFormatof a givenPOSModel- Parameters:
posModel- must not benull.- Returns:
- the guessed
POSTagFormat.
-