Package opennlp.tools.document
Class Layers
java.lang.Object
opennlp.tools.document.Layers
The standard
layer keys for the results the toolkit produces itself.
Every key defined here carries the opennlp: id prefix, which
key(String, Class) and documentKey(String, Class) apply. Other
producers define their keys in their own packages under their own prefix.
- Since:
- 3.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionNamed entities; each annotation covers one mention and carries the entity type as its value.private static final StringThe id prefix of every key the toolkit defines.Part-of-speech tags; one annotation per token, aligned withTOKENSby position, carrying the tag.Sentence boundaries; each annotation covers one sentence and carries its text.Token boundaries; each annotation covers one token and carries its text. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> LayerKey<T> documentKey(String name, Class<T> type) Creates adocument-scopedkey in the toolkit'sopennlp:namespace, for a whole-document value the toolkit itself produces.static <T> LayerKey<T> Creates apositionalkey in the toolkit'sopennlp:namespace, for a layer the toolkit itself produces.private static StringValidates a namespace-free layer name.
-
Field Details
-
NAMESPACE
The id prefix of every key the toolkit defines.- See Also:
-
SENTENCES
Sentence boundaries; each annotation covers one sentence and carries its text. -
TOKENS
Token boundaries; each annotation covers one token and carries its text. -
POS_TAGS
Part-of-speech tags; one annotation per token, aligned withTOKENSby position, carrying the tag. -
ENTITIES
Named entities; each annotation covers one mention and carries the entity type as its value. The annotation's span carries offsets only.
-
-
Constructor Details
-
Layers
private Layers()
-
-
Method Details
-
key
Creates apositionalkey in the toolkit'sopennlp:namespace, for a layer the toolkit itself produces.- Type Parameters:
T- The type of the annotation values.- Parameters:
name- The layer name without a namespace, for exampletokens. Must not benull, blank, or contain':'.type- The class of the annotation values stored under the key. Must not benull.- Returns:
- A key whose id is the name under the
opennlp:prefix. Nevernull. - Throws:
IllegalArgumentException- Thrown ifnameisnull, blank, or contains':', ortypeisnull.
-
documentKey
Creates adocument-scopedkey in the toolkit'sopennlp:namespace, for a whole-document value the toolkit itself produces.- Type Parameters:
T- The type of the annotation values.- Parameters:
name- The layer name without a namespace, for examplelanguage. Must not benull, blank, or contain':'.type- The class of the annotation values stored under the key. Must not benull.- Returns:
- A document-scoped key whose id is the name under the
opennlp:prefix. Nevernull. - Throws:
IllegalArgumentException- Thrown ifnameisnull, blank, or contains':', ortypeisnull.
-
validName
Validates a namespace-free layer name.- Parameters:
name- The name to validate.- Returns:
- The validated name.
- Throws:
IllegalArgumentException- Thrown ifnameisnull, blank, or contains':'.
-