www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Fuzzy Levenshtein variant of std.conv.to

reply "Per =?UTF-8?B?Tm9yZGzDtnci?= <per.nordlow gmail.com> writes:
At

https://github.com/nordlow/justd/blob/master/conv_ex.d

I'm trying to figure out how to best implement a fuzzy variant of 
std.conv.to when converting a string to an enum.

I'm almost there but I'm uncertain how to best pick the index of 
the smallest element in `distances` and then convert it to the 
corresponding enumerator for when `U` is an enum.

Help please.
Apr 28 2015
parent reply "Per =?UTF-8?B?Tm9yZGzDtnci?= <per.nordlow gmail.com> writes:
On Tuesday, 28 April 2015 at 16:20:24 UTC, Per Nordlöw wrote:

I update my Github repo. I had forgotten to push my latest 
changes.
Apr 28 2015
parent reply "Per =?UTF-8?B?Tm9yZGzDtnci?= <per.nordlow gmail.com> writes:
On Tuesday, 28 April 2015 at 23:09:27 UTC, Per Nordlöw wrote:
 On Tuesday, 28 April 2015 at 16:20:24 UTC, Per Nordlöw wrote:

 I update my Github repo. I had forgotten to push my latest 
 changes.
I solved it.
Apr 29 2015
parent "Jakob Ovrum" <jakobovrum gmail.com> writes:
On Wednesday, 29 April 2015 at 14:46:04 UTC, Per Nordlöw wrote:
 On Tuesday, 28 April 2015 at 23:09:27 UTC, Per Nordlöw wrote:
 On Tuesday, 28 April 2015 at 16:20:24 UTC, Per Nordlöw wrote:

 I update my Github repo. I had forgotten to push my latest 
 changes.
I solved it.
I started working on this yesterday before you solved it, and ended up finishing a solution. It was a fun excercise, thanks. https://gist.github.com/JakobOvrum/515737710619a9d97273 It uses a loop instead of a range composition because of the early return when the Levenshtein distance is 0; that would be clumsy to express with ranges.
Apr 29 2015