com.johnsnowlabs.nlp.embeddings
Whether to ignore case in index lookups (Default depends on model)
Whether to ignore case in index lookups (Default depends on model)
Word Embeddings lookup annotator that maps tokens to vectors
Word Embeddings lookup annotator that maps tokens to vectors
Number of embedding dimensions (Default depends on model)
Number of embedding dimensions (Default depends on model)
input annotations columns currently used
Gets annotation column name going to generate
Gets annotation column name going to generate
Input annotation type : DOCUMENT, TOKEN
Input annotation type : DOCUMENT, 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
Error message
Error message
Output annotation type : WORD_EMBEDDINGS
Output annotation type : WORD_EMBEDDINGS
Cache size for items retrieved from storage.
Cache size for items retrieved from storage. Increase for performance but higher memory consumption
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
Cache size for items retrieved from storage.
Cache size for items retrieved from storage. Increase for performance but higher memory consumption.
Buffer size limit before dumping to disk storage while writing.
Unique identifier for storage (Default: this.uid
)
Unique identifier for storage (Default: this.uid
)
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
Buffer size limit before dumping to disk storage while writing
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
Word Embeddings lookup annotator that maps tokens to vectors.
For instantiated/pretrained models, see WordEmbeddingsModel.
A custom token lookup dictionary for embeddings can be set with
setStoragePath
. Each line of the provided file needs to have a token, followed by their vector representation, delimited by a spaces.If a token is not found in the dictionary, then the result will be a zero vector of the same dimension. Statistics about the rate of converted tokens, can be retrieved with WordEmbeddingsModel.withCoverageColumn and WordEmbeddingsModel.overallCoverage.
For extended examples of usage, see the Spark NLP Workshop and the WordEmbeddingsTestSpec.
Example
In this example, the file
random_embeddings_dim4.txt
has the form of the content above.Annotators Main Page for a list of transformer based embeddings
SentenceEmbeddings to combine embeddings into a sentence-level representation