editdist

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package editdist includes a Levenshtein automaton as well as a traditional implementation to calculate Levenshtein Distance. The code is based on an excellent levenshtein implementation at https://github.com/agnivade/levenshtein

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeDistance

func ComputeDistance(a, b string, diff bool) (int, string, string)

ComputeDistance computes the levenshtein distance between the two strings passed as arguments. The third argument is a flag that would trigger creation of tagged strings that show how exactly the two strings differ. If the diff artument is true, the tagged strings will be provided in the output.

func ComputeDistanceMax

func ComputeDistanceMax(a, b string, max int) (int, bool)

ComputeDistanceMax computes the levenshtein distance between the two strings passed as an argument. It stops execution if edit distance grows a certain max value. It returns edit distance and a boolean. The boolean is true when calculation was aborted by the `max` value.

func ComputeDistanceTerm added in v0.3.0

func ComputeDistanceTerm(a, b string) (int, string, string)

ComputeDistanceTerm comutes edit distance between two strings and teturns back edit distance and strings that show the difference between compared strings using terminal colors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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