Retrieves the significant part of a word
Retrieves the significant part of a word
External dictionary to be used by the lemmatizer, which needs 'keyDelimiter
' and 'valueDelimiter
' for parsing the resource
External dictionary to be used by the lemmatizer, which needs 'keyDelimiter
' and 'valueDelimiter
' for parsing the resource
... pick -> pick picks picking picked peck -> peck pecking pecked pecks pickle -> pickle pickles pickled pickling pepper -> pepper peppers peppered peppering ...
where each key is delimited by ->
and values are delimited by \t
External dictionary to be used by the lemmatizer
input annotations columns currently used
Gets annotation column name going to generate
Gets annotation column name going to generate
Input annotator type : TOKEN
Input annotator type : TOKEN
columns that contain annotations necessary to run this annotator AnnotatorType is used both as input and output columns if not specified
columns that contain annotations necessary to run this annotator AnnotatorType is used both as input and output columns if not specified
Output annotator type : TOKEN
Output annotator type : TOKEN
External dictionary to be used by the lemmatizer, which needs keyDelimiter
and valueDelimiter
for parsing
the resource
External dictionary already in the form of ExternalResource, for which the Map member options
has entries defined for "keyDelimiter"
and "valueDelimiter"
.
External dictionary already in the form of ExternalResource, for which the Map member options
has entries defined for "keyDelimiter"
and "valueDelimiter"
.
val resource = ExternalResource( "src/test/resources/regex-matcher/rules.txt", ReadAs.TEXT, Map("keyDelimiter" -> "->", "valueDelimiter" -> "\t") ) val lemmatizer = new Lemmatizer() .setInputCols(Array("token")) .setOutputCol("lemma") .setDictionary(resource)
Overrides required annotators column if different than default
Overrides required annotators column if different than default
Overrides annotation column name when transforming
Overrides annotation column name when transforming
requirement for pipeline transformation validation.
requirement for pipeline transformation validation. It is called on fit()
required internal uid provided by constructor
required internal uid provided by constructor
takes a Dataset and checks to see if all the required annotation types are present.
takes a Dataset and checks to see if all the required annotation types are present.
to be validated
True if all the required types are present, else false
Required input and expected output annotator types
A list of (hyper-)parameter keys this annotator can take. Users can set and get the parameter values through setters and getters, respectively.
Class to find lemmas out of words with the objective of returning a base dictionary word. Retrieves the significant part of a word. A dictionary of predefined lemmas must be provided with
setDictionary
. The dictionary can be set in either in the form of a delimited text file or directly as an ExternalResource. Pretrained models can be loaded with LemmatizerModel.pretrained.For available pretrained models please see the Models Hub. For extended examples of usage, see the Spark NLP Workshop and the LemmatizerTestSpec.
Example
In this example, the lemma dictionary
lemmas_small.txt
has the form ofwhere each key is delimited by
->
and values are delimited by\t
LemmatizerModel for the instantiated model and pretrained models.