James Edward Gray II wrote:
> On Aug 23, 2006, at 2:16 PM, David Vallner wrote:
>
>> Josselin wrote:
>>> I am not yet a big friend of reegxp.. and I don't actually know if I
>>> should use it or any other function
>>> but I'd like to know the easiest path to do the following :
>>> I get a string person = 'Clara Mint" which is a full name
>>> and I would like to find the object "id" in a collection using this
>>> full name :
>>> people = [ ["id" => "1", "first" => "Jack", "last" => "Johnson"],
>>> ["id" => "2", "first" => "Ben", "last" => "Kenneth"], ["id" => "3",
>>> "first" => "Ken", "last" => "Olsen"], ["id" => "4", "first" =>
>>> "Howard", "last" => "Wong"], ["id" => "5", "first" => "Clara", "last"
>>> => "Mint"], ["id" => "7", "first" => "Che", "last" => "Guevara"]]
>>> any hint to start ?
>>> Joss
>>
>> first, last = person.split(/\s+/)
>> found_person = people.find { | person |
>> person["first"] == first and person["last"] = last
>> }
>
> Be warned, parsing names correctly is a non-trivial task...
>
> James Edward Gray II (Hint, hint!)
>
> P.S. My wife's name is Dana Ann Leslie Gray, so don't forget to handle
> that too. ;)
>
> P.P.S. I smell Ruby Quiz material... :D
>
>
Working for a collection agency in the SW I found this a very big
problem, especially with Hispanic names where you can have the name
given to us as Juanita Garcia Rodriguez or worse. And of course we may
get it differently from another client. I have to try and split them
properly for Credit Reporting and with hundreds of thousands of names it
has to be done by computer.