com.johnsnowlabs.nlp.annotators.spell.symmetric
Minimum frequency of corrections a word needs to have to be considered from training.
Minimum frequency of corrections a word needs to have to be considered from training. Increase if training set is LARGE (Default: 0
).
Created by danilo 26/04/2018 Computes derived words from a frequency of words
Spell checking algorithm inspired on Symmetric Delete algorithm
Spell checking algorithm inspired on Symmetric Delete algorithm
Optional dictionary of properly written words.
Optional dictionary of properly written words. If provided, significantly boosts spell checking performance.
Needs "tokenPattern"
(Default: \S+
) for parsing the resource.
... gummy gummic gummier gummiest gummiferous ...
Maximum duplicate of characters in a word to consider (Default: 2
).
Maximum duplicate of characters in a word to consider (Default: 2
).
Minimum frequency of words to be considered from training.
Minimum frequency of words to be considered from training. Increase if training set is LARGE (Default: 0
).
Created by danilo 14/04/2018 Given a word, derive strings with up to maxEditDistance characters deleted
Minimum frequency of corrections a word needs to have to be considered from training.
Minimum frequency of corrections a word needs to have to be considered from training. Increase if training set is LARGE (Default: 0
).
Maximum duplicate of characters in a word to consider (Default: 2
).
Maximum duplicate of characters in a word to consider (Default: 2
).
Minimum frequency of words to be considered from training.
Minimum frequency of words to be considered from training. Increase if training set is LARGE (Default: 0
).
input annotations columns currently used
Max edit distance characters to derive strings from a word
Max edit distance characters to derive strings from a word
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
Length of longest word in corpus
Length of longest word in corpus
Max edit distance characters to derive strings from a word (Default: 3
)
Max edit distance characters to derive strings from a word (Default: 3
)
Maximum frequency of a word in the corpus
Maximum frequency of a word in the corpus
Minimum frequency of a word in the corpus
Minimum frequency of a word in the corpus
Output annotator type : TOKEN
Output annotator type : TOKEN
Minimum frequency of corrections a word needs to have to be considered from training.
Minimum frequency of corrections a word needs to have to be considered from training. Increase if training set is LARGE (Default: 0
).
Path to file with properly spelled words, tokenPattern
is the regex pattern to identify them in text,
readAs can be ReadAs.TEXT
or ReadAs.SPARK
, with options passed to Spark reader if the latter is set.
Path to file with properly spelled words, tokenPattern
is the regex pattern to identify them in text,
readAs can be ReadAs.TEXT
or ReadAs.SPARK
, with options passed to Spark reader if the latter is set.
Dictionary needs tokenPattern
regex for separating words.
External dictionary already in the form of ExternalResource, for which the Map member options
has an entry defined for "tokenPattern"
.
External dictionary already in the form of ExternalResource, for which the Map member options
has an entry defined for "tokenPattern"
.
val resource = ExternalResource( "src/test/resources/spell/words.txt", ReadAs.TEXT, Map("tokenPattern" -> "\\S+") ) val spellChecker = new SymmetricDeleteApproach() .setInputCols("token") .setOutputCol("spell") .setDictionary(resource)
Maximum duplicate of characters in a word to consider (Default: 2
)
Maximum duplicate of characters in a word to consider (Default: 2
)
Minimum frequency of words to be considered from training.
Minimum frequency of words to be considered from training. Increase if training set is LARGE (Default: 0
)
Overrides required annotators column if different than default
Overrides required annotators column if different than default
Length of longest word in corpus
Length of longest word in corpus
Max edit distance characters to derive strings from a word
Max edit distance characters to derive strings from a word
Maximum frequency of a word in the corpus
Maximum frequency of a word in the corpus
Minimum frequency of a word in the corpus
Minimum frequency of a word in the corpus
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()
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
Trains a Symmetric Delete spelling correction algorithm. Retrieves tokens and utilizes distance metrics to compute possible derived words.
Inspired by SymSpell.
For instantiated/pretrained models, see SymmetricDeleteModel.
See SymmetricDeleteModelTestSpec for further reference.
Example
In this example, the dictionary
"words.txt"
has the form ofThis dictionary is then set to be the basis of the spell checker.
ContextSpellCheckerApproach for a DL based approach
NorvigSweetingApproach for an alternative approach to spell checking