-Поиск по дневнику

Поиск сообщений в rss_thedaily_wtf

 -Подписка по e-mail

 

 -Постоянные читатели

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 06.04.2008
Записей:
Комментариев:
Написано: 0


CodeSOD: Genderize

Вторник, 25 Ноября 2014 г. 14:00 + в цитатник

If someone suggested that you write a function which, given a persons name, tells you what gender they are, you might caution that this is a hard problem. You might suggest a solution like a Bayesian classifier, which could be trained, or you might say, Maybe we should just let the users tell us.

There are a few things you almost certainly wouldnt suggest. You wouldnt suggest using ColdFusion , because CF is constructed out of sin and unicorn tears. And you certainly wouldnt suggest trying to use regexes to do this job.

Thats because you arent Brents co-worker, who wrote this:

this.genderize(Arguments.firstName)


       

       
              var regex = "";

              regex = "(ua|pher|andy|elijah)$";
              if (REFindNoCase(regex, Arguments.name)) {return "male";}

              regex = "(a|i|y|ah|ee|et|ette|elle|fer|ine|lyn|ie|anne|een|en|er|yn|ynn|kim|rachel|lind|pam|sue)$";
              if (REFindNoCase(regex, Arguments.name)) {return "female";}

              return "male";
       

http://thedailywtf.com/articles/genderize

Метки:  

 

Добавить комментарий:
Текст комментария: смайлики

Проверка орфографии: (найти ошибки)

Прикрепить картинку:

 Переводить URL в ссылку
 Подписаться на комментарии
 Подписать картинку