Documentation ¶
Overview ¶
Package jarowinkler implements fuzzy matching based on the Jaro-Winkler metric.
Index ¶
Constants ¶
const AdaptiveThreshold = -1
AdaptiveThreshold indicates that the threshold should be computed dynamically based on the input length.
Variables ¶
This section is empty.
Functions ¶
func Select ¶
Select selects items from the set of available choices based on similarity to the target according to the Jaro-Winkler metric. The selections are sorted in descending order with respect to their similarity to the target string.
By default,
- Choices that are not sufficiently similar to the string are discarded based on an adaptive threshold. If a custom threshold is desired, use the WithThreshold option.
- The number of choices that are returned is unlimited; to limit the number of returned results, use the WithLimit option.
- The selection process is case-insensitive; to change this, use the WithCaseInsensitivity option.
func Similarity ¶
Similarity computes the Jaro-Winkler similarity between a and b. The result falls in the range 0, indicating no match, to 1, indicating a perfect match.
Types ¶
type SelectOpt ¶
type SelectOpt func(*selectOpts)
A SelectOpt enables fine-tuning of the selection process.
func WithCaseSensitivity ¶
WithCaseSensitivity returns an option that enables/disables case-sensitive matching based on the enabled parameter.
func WithLimit ¶
WithLimit returns an option that limits the number of returned results to at most limit. If limit < 0, the number of results is unlimited.
func WithThreshold ¶
WithThreshold returns an option that discards choices such that the Jaro-Winkler similarity to the target string is less than threshold. If threshold == AdaptiveThreshold, an adaptive threshold based on the length of the target string will be used.