C# Class StopGuessing.DataStructures.EditDistance

A static class for calculating the edit distance between two strings, factoring in not just the standard additions, deletions, and subtstitutions, but also case changes ('a'->'A') and transpositions ('typo'->'tpyo'). The caller may set the cost of each type of edit and the calculator will compute the least-cost edit from the source string to the destination string.
Exibir arquivo Open project: Microsoft/StopGuessing

Public Methods

Method Description
Calculate ( char xstr, char ystr, Costs costs = null ) : float
Calculate ( string sourceString, string destinationString, Costs costs = null ) : float

Calculate the cost to edit a source string into a destination string, where the set of possible operations (add char, delete char, substitute one char for another, transpose adjacent characters, or change the case of a character) can be set by the caller.

Method Details

Calculate() public static method

public static Calculate ( char xstr, char ystr, Costs costs = null ) : float
xstr char
ystr char
costs Costs
return float

Calculate() public static method

Calculate the cost to edit a source string into a destination string, where the set of possible operations (add char, delete char, substitute one char for another, transpose adjacent characters, or change the case of a character) can be set by the caller.
public static Calculate ( string sourceString, string destinationString, Costs costs = null ) : float
sourceString string The string to be changed (edited).
destinationString string The string that the source string should be turned into through edits.
costs Costs The cost of each of the types of changes that can be made.
return float