suggest

package
v0.44.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMinimumSimilarityScore = 0.2

Variables

This section is empty.

Functions

func Score

func Score(given, suggestion string) float64

Score calculates the similarity score in the range of 0..1 of two strings. A score of 1 means the strings are identical, and 0 means they have nothing in common.

func Similar

func Similar(builder *brigodier.SuggestionsBuilder, candidates []string) *brigodier.SuggestionsBuilder

Similar calls SimilarScore with DefaultMinimumSimilarityScore.

func SimilarScore

func SimilarScore(builder *brigodier.SuggestionsBuilder, candidates []string, minScore float64) *brigodier.SuggestionsBuilder

SimilarScore sorts and suggests only similar matching candidates based on the current argument input.

It filters and sorts the best matching candidates based on the levenshtein similarity score of the current input so far.

A candidate Score below minScore is dropped from the suggestions. No candidates are dropped when minScore >= 1, this is useful for using this function for sorting candidates by score only.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL