internal types to show Rows as a relevant StructType Should be deleted once Spark releases UserDefinedTypes to @developerAPI
internal types to show Rows as a relevant StructType Should be deleted once Spark releases UserDefinedTypes to @developerAPI
takes a document and annotations and produces new annotations of this annotator's annotation type
takes a document and annotations and produces new annotations of this annotator's annotation type
Annotations in batches that correspond to inputAnnotationCols generated by previous annotators if any
any number of annotations processed for every batch of input annotations. Not necessary one to one relationship IMPORTANT: !MUST! return sequences of equal lengths !! IMPORTANT: !MUST! return sentences that belong to the same original row !! (challenging)
Size of every batch (Default depends on model).
Size of every batch (Default depends on model).
ConfigProto from tensorflow, serialized into byte array.
ConfigProto from tensorflow, serialized into byte array. Get with config_proto.SerializeToString()
requirement for annotators copies
requirement for annotators copies
datasetParams
Override for additional custom schema checks
Override for additional custom schema checks
Size of every batch.
Size of every batch.
get the tags used to trained this NerDLModel
datasetParams
whether to include all confidence scores in annotation metadata or just the score of the predicted tag
Whether to include confidence scores in annotation metadata
input annotations columns currently used
Minimum probability.
Minimum probability. Used only if there is no CRF on top of LSTM layer.
ConfigProto from tensorflow, serialized into byte array.
ConfigProto from tensorflow, serialized into byte array. Get with config_proto.SerializeToString()
Gets annotation column name going to generate
Gets annotation column name going to generate
whether to include all confidence scores in annotation metadata or just score of the predicted tag
Whether to include confidence scores in annotation metadata (Default: false
)
Input Annotator Types: DOCUMENT, TOKEN, WORD_EMBEDDINGS
Input Annotator Types: DOCUMENT, TOKEN, WORD_EMBEDDINGS
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
Minimum probability.
Minimum probability. Used only if there is no CRF on top of LSTM layer.
Output Annnotator type: NAMED_ENTITY
Output Annnotator type: NAMED_ENTITY
Size of every batch.
Size of every batch.
ConfigProto from tensorflow, serialized into byte array.
ConfigProto from tensorflow, serialized into byte array. Get with config_proto.SerializeToString()
datasetParams
whether to include confidence scores for all tags rather than just for the predicted one
Whether to include confidence scores in annotation metadata
Overrides required annotators column if different than default
Overrides required annotators column if different than default
Minimum probability.
Minimum probability. Used only if there is no CRF on top of LSTM layer.
Overrides annotation column name when transforming
Overrides annotation column name when transforming
Unique identifier for storage (Default: this.uid
)
Unique identifier for storage (Default: this.uid
)
Given requirements are met, this applies ML transformation within a Pipeline or stand-alone Output annotation will be generated as a new column, previous annotations are still available separately metadata is built at schema level to record annotations structural information outside its content
Given requirements are met, this applies ML transformation within a Pipeline or stand-alone Output annotation will be generated as a new column, previous annotations are still available separately metadata is built at schema level to record annotations structural information outside its content
Dataset[Row]
requirement for pipeline transformation validation.
requirement for pipeline transformation validation. It is called on fit()
required uid for storing annotator to disk
required uid for storing annotator to disk
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
A list of (hyper-)parameter keys this annotator can take. Users can set and get the parameter values through setters and getters, respectively.
Required input and expected output annotator types
This Named Entity recognition annotator is a generic NER model based on Neural Networks.
Neural Network architecture is Char CNNs - BiLSTM - CRF that achieves state-of-the-art in most datasets.
This is the instantiated model of the NerDLApproach. For training your own model, please see the documentation of that class.
Pretrained models can be loaded with
pretrained
of the companion object:The default model is
"ner_dl"
, if no name is provided.For available pretrained models please see the Models Hub. Additionally, pretrained pipelines are available for this module, see Pipelines.
Note that some pretrained models require specific types of embeddings, depending on which they were trained on. For example, the default model
"ner_dl"
requires the WordEmbeddings"glove_100d"
.For extended examples of usage, see the Spark NLP Workshop and the NerDLSpec.
Example
NerConverter to further process the results
NerCrfModel for a generic CRF approach