...

Package misspell

import "github.com/rogpeppe/go-internal/internal/misspell"
Overview
Index

Overview ▾

Package misspell impements utilities for basic spelling correction.

func AlmostEqual

func AlmostEqual(a, b string) bool

AlmostEqual reports whether a and b have Damerau-Levenshtein distance of at most 1. That is, it reports whether a can be transformed into b by adding, removing or substituting a single rune, or by swapping two adjacent runes. Invalid runes are considered equal.

It runs in O(len(a)+len(b)) time.