I know this is an old question, but since Google brought me here, maybe it will bring some future beings here as well...
I would recommend using the Jaro-Winkler Distance which is defined in terms of the Jaro Distance $d_j$, the common prefix length of the two strings $l$ (bounded by some maximum value, let's say $b$), and a prefix scaling factor $p$. It is important that you select the parameters $b$ and $p$ such that their product does not exceed one.
$d_{jw} = d_j + lp(1-d_j) = lp + d_j(1-lp)$
Conceptually, it's probably easiest to think of it as a convex combination (weighted average where the weights sum to one) of the Jaro distance and one with weights $1-lp$ and $lp$, respectively. Thus we see that it is important to bound $lp$ to the range $[0, 1]$, otherwise this expression is no longer a convex combination, so we may obtain values outside the range of the Jaro distance: $[0, 1]$.
Obligatory note about the word metric: when we speak of string distance metrics in general, the word "metric" doesn't carry its formal mathematical definition, but rather its basic English definition: "a means by which to measure something."
"Richard"
and the string"Rikard"
using something like the Levenshtein Distance. However, I have no idea how you would measure the distance between"Richard"
and"?rd"
if?
is a special meta-character representing truncation. If question marks represent truncation, then"?rd"
does not represent a string. Instead,"?rd"
represents a set of strings. What set is"?rd"
? $\endgroup$"?rd"
to refer to the set of all strings which begin with zero or more characters and end in"rd"
? $\endgroup$!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnop qrstuvwxyz{|}~
Those are the ASCII characters beggining at 32 and ending at 126. That includes 32 and 126. I could be wrong, but maybe you are using the notation"?rd"
to represent the set of all strings which end in"rd"
? $\endgroup$"?"
is a question mark, not a meta-character for truncation. You seem to be asking for a metric which compares two sets of strings for similarity. The sets of strings could be notated using something like regular expressions. $\endgroup$