stringMatch: Implementation of the Levenshtein Algorithm

Description Usage Arguments Value Author(s) References Examples

View source: R/stringMatch.R

Description

Function to compare the similarity of two different character strings

Usage

1
stringMatch(string.1, string.2, normalize = c("YES", "NO"), penalty = 1, case.sensitive = FALSE)

Arguments

string.1

The first character string

string.2

The second character string

normalize

a character string indicating which method to use; if normalize = 'YES', then the edit distance is normalized to fall in the interval [0,1]

penalty

The edit cost

case.sensitive

logical; if TRUE, then a penalty occurs for differences in case of a character

Value

a numeric value. If normalize = 'YES', then the edit distance is normalized to fall in the interval [0,1]. Else, the Levenshtein edit distance is returned.

Author(s)

Harold C. Doram

References

http://en.wikipedia.org/wiki/Levenshtein\_distance

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Return edit distance
stringMatch('William Clinton', 'Bill Clinton', normalize='NO')

## Return normalized edit distance
stringMatch('William Clinton', 'Bill Clinton', normalize='YES')

## Ignore differences in case
stringMatch('Bill Clinton', 'bill Clinton', normalize='YES', case.sensitive = FALSE)

## Do not ignore differences in case
stringMatch('Bill Clinton', 'bill Clinton', normalize='YES', case.sensitive = TRUE)

wasabi1989/MiscPsycho documentation built on Jan. 19, 2020, 12:29 a.m.