[R] AGREP
Michael Friendly
friendly at yorku.ca
Sat Feb 14 00:18:39 CET 2004
The problem of calculating levenshtein distances between strings reminds
me of what I faced
years ago when writing an APL system to control interactive memory
experiments, where subjects
typed words they could remember from a given list.
To handle typos, I used the generalized outer product operator, null dot
equals to create
a binary matrix comparing an input string with each correct word,
input o.= word
giving a 0/1 array whose rows reprepresented the letters in the input
and whose columns
the letters in the output, from which varous measures of string
similarity could be calculated
using reduction operators, or even a correlation, based on the positions
of the 1s.
Thinking in arrays always helps avoid explicit loops.
--
Michael Friendly Email: friendly at yorku.ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA
More information about the R-help
mailing list