There was a need to determine the gender of customers in the database and automatically decline the full name for the online store. The specifics of the store are gifts and flower delivery with congratulations.
The store accepts information about users through a quick order form. There is also a regular basket, but many use just a quick order - there you can fill only the phone and immediately go to pay. Customers use the opportunity and often do not specify the name at all. It is pointless to make fields for full names mandatory - enter garbage instead of data is not prohibited. As well as not to prohibit incorrectly writing your own name.
Meanwhile, the correct appeal to the client is necessary, otherwise incidents are possible:

Now the store employees are refining the data in a prehistoric way: the customer makes an order, an SMS arrives with confirmation and delivery method. And then the operator calls to confirm the order and at the same time to clarify the floor and full name, and then enters the data in the CRM.
But in general, it's 2016, and it's not cool:
- operators are just humans and occasionally felled. If the name was not originally indicated, it is easy to confuse the flowers for Vali with the flowers for Vari;
- in a telephone conversation, employees recite names by letter, which makes people extremely angry;
- for congratulations, the names in postcards and color signatures sometimes lean, and this is not always a trivial task (for example, Artem Luchenk was written as “Luchenok”).
The manual method is long, expensive, and not like that of Tyoma Lebedev. Ideally, I want to automate everything and get rid of the human factor. And asking a person for calls only in borderline cases, where even a person will not understand (a neural network can draw a picture better than Van Gogh, but never guess the floor of Sasha Parkhomenko).
What I wanted:
- determine the gender of users in the database for segmentation - to prepare promotional offers for gifts for gender holidays for customers;
- check the spelling of names;
- automatically decry names for smart generation of cards, greetings, signatures to the delivered flowers;
high quality, free and yesterday inexpensive and error free.
Having investigated a subject domain, I went to study Habr and the Internet in search of the made ready decision. So that both the floor is determined, and declined, and united in itself 2 of these chips (ideally). Perhaps my review will be useful to someone.
I decided to approach the research in detail and took a sample from simple to complex names. Armed with a diploma. Ru and his fantasy.
The result is a simple test for the names:
- simple Russian names in various combinations (Masha Tsvetkova, Anton Sergeevich Zhuravlev);
- borderline cases where the sex is not obvious even to a person (Valea Drozdenko);
- double surnames (Demuth-Malinovsky);
- women's unwitting women's names (Raisat Magomedova, Anna Druz);
- female names on-ale (Adel, Aigul). There is a catch in them - there is no single rule how to persuade such names;
- cool male name Jalil, who suddenly met several times in the database;
- Russian non-standard: Craft.
But non-trivial cases, about which few people know:
- declination of the family name without loss of the vowel: Ivan Pleten - Ivan Pleten;
- case with the loss of a vowel in the names of -onok / -enok: Vasily Luchenok - Vasily Luchenka;
- patronymic from ogly / kyzy (Magomedova Gyulchatay Abdurakhman kyzy).
Total found 2 libraries and 3 services that caused the trust.

pros
- works with Russian and Ukrainian names.
Minuses
Based on the description of the API, the definition of gender is not the main functionality, but an additional feature. The service can be sent by the user gender parameter, and this affects the further logic of working with names.
Library:
- does not know who Jalil is;
- border case "Sasha Parkhomenko" confidently identified as a woman;
- "Raisat" identified as a man;
- The complex case of "Ivan Pleten" declined as "Ivan Pletyogo."
- “Bonch-Bruyevich” in Ukrainian is a name, and in Russian for some reason it is considered a patronymic. Crime, to be honest.
And judging by the fact that the site is in 2011, the library support has long ceased.

Pros:
- implemented on several PLs, including JS and Ruby;
- not bad declines simple cases, if they put down the floor.
Minuses:
- gender does not determine;
- inclines female names as male (Aigul - Aigul);
- I could not chew on the complex name of “Aliyev Ruslan Heydar oglu”. The library silently cut the prefix to the middle name;
- incorrectly declined double surnames (for example, Gres-Yankovsky → Gres-Yankovsky).
Did not like.
UPD. The comments revealed that the main task of the library is the declination of the full name. Determining gender is not a direct task of the library, and for correct work the floor should be indicated. With the specified floor Petrovich works much better.
“Valera ;; female”. Nuff said.
Pros:
- there is a REST API;
- not only determines and declines the name, but also works with addresses;
- trying to identify ethnicity by surname, and very well;
- suggests options directly in the input form: in one line and several fields (separate first name, first name, middle name);
- sex determination and declination on simple and medium cases work well. He is friends with Jalil and Judith.
Minuses:
- Sasha Parkhomenko considered a man, the same situation for all border cases. That is, all doubtful cases will be men, and this is wrong. It is impossible to unequivocally consider a border case as a man or a woman, you need to warn a person that the robot is confused and suffering;
- The male interpretation of Sasha Parkhomenko is considered a Slavic name, and the female one is Indo-European. It made you think about the accuracy of the algorithms;
- in the form of hints, incompatible combinations come across: “Alisa Vasilyev”, “Nikolai Vladimirova”. It is not known what to expect in the future, as such overt misprints slip in simple cases;
- in autocomplex on individual fields, the data is not always combined by sex. According to Murphy's law, a user will surely make a mistake where he can be mistaken.
Sasha Parkhomenko strained, decided to look for more options.

Pros:
- there is an API with normal documentation and examples;
- perfectly bends the names, coped with almost all cases;
- if no gender is specified, the API notifies about this by a separate value. Sasha Parkhomenko is finally not a man or a woman;
- On the order form, you can put a JS-plugin and determine the floor for all new customers.
Minuses:
- if the service does not know the last name, it does not decline, simply determines the gender
- auto-complete name is free, but processing through the API is paid.
Pros:
- inclines everything that can be inclined: names, cities, phrases, numerals, dates;
- gives data via a web service, there are separate libraries, modules for Excel, integration with Mailchimp;
- inclines really cool and simple, and complex, and super-complex cases. Not confused in the head of the / -kyzy, in double surnames, in biblical names;
- free functionality is enough for normal declination (1000 requests per day).
Minuses:
- does not know how to determine gender in borderline cases (Sasha Parkhomenko is considered a man by default);
- the cost of the library is not indicated, there is a feeling that they want to earn more money from me.
The peculiarity is not to incline female names to -l (Aigul). This is not a mistake, one of the possible options (according to the rules such names can either be inclined or not).
Service I was very impressed in terms of declinations. Easily coped with simple and complex cases.
But Sasha Parkhomenko distressed (a).
The most worthy services seemed Morfer and DaData. On declination, they showed themselves almost equally except for names like Aigul - apparently, the creators have a different philosophy. It seemed to me that Morfer - a kind of robot Bender, bends all that bends and makes it very cool. Dadata is something like Valli, can do less, but does more carefully. I am pleased to recommend both services.
What service I chose - I will not say. I believe that each task has its own tool, and I hope that the review will help you understand what is suitable for anyone.
If someone knows good similar services and google better than me, I will be very happy with comments and advice.