<!--/*SC*/DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"/*EC*/-->
<html><head><title></title><style type="text/css"><!--body{padding:1ex;margin:0px;font-family:sans-serif;font-size:small;}a[href]{color:-moz-hyperlinktext !important;text-decoration:-moz-anchor-decoration;}blockquote{margin:0;border-left:2px solid #144fae;padding-left:1em;}blockquote blockquote{border-color:#006312;}blockquote blockquote blockquote{border-color:#540000;}--></style></head><body><div style="font-family: Arial; font-size: medium;" dir="ltr"><div>I'm parsing a simple, domain specific scripting language that has commands like the following: *page, *title, *text, *footer, etc. There are about 100 of these '*' commands. When we see a command that we don't recognize, I would like to find the closest match possible (from a list of all legal commands) and include this suggestion in our diagnostic output.</div>
<div> </div>
<div>I'm not sure what you would call the type of algorithm I'm looking for: closest matching string or auto-correct?</div>
<div> </div>
<div>Any suggestions on algorithms or python libraries that would help me do what I'm looking for?</div>
<div> </div>
<div>Here's my short-list of ideas based on my research so far:</div>
<div>- Soundex</div>
<div>- Lawrence Philips' Metaphone Algorithm (from aspell?)</div>
<div>- Edit Distance Algorithm</div>
<div>- Levenstein Word Distance</div>
<div> </div>
<div>Any suggestions, comments on the above techniques, or ideas on a simpler algorithm for finding close string matches based on a list, dict, or set of possible strings?</div>
<div> </div>
<div>Thank you,</div>
<div>Malcolm</div>
<div> </div></div></body></html>