📜 ⬆️ ⬇️

Automatic sex detection by name

Continuing to talk about the technologies that are used in our email-marketing service Pechkin-mail.ru , we are simply obliged to mention the automatic identification of the subscriber's gender by name. Back in 2007, when developing the sms-mailing service, we very much wanted to realize the possibility of automatically inserting endings into adjectives “Dear”, “Dear”, and so on. Usually such substitution is carried out on the basis of an additional field in the client's address base. However, as it seems to us, this sucks.
There are 3 reasons for this:
  1. forcing the subscriber to ask your gender is stupid (the more fields in the form, the lower the probability of its filling)
  2. define manually - long, which means it's expensive
  3. the person is not insured from mistakes exactly the same as the machine.


But we are not linguists, so it would be too difficult for us to implement such a module, and the function is “not essential.” But recently, working on the declensions of texts of endless acts, contracts and other legal documents, we remembered the Morfer service that we used for 2 years. This is an excellent linguistic service specializing in Russian and allowing to incline words, whole sentences, numerals, as well as receive text from numbers. In general, the amazing development of just one person - Sergey Slepov .

So, after some time, we open his site and discover that there is a convenient and simple module for PHP that allows you to determine the gender of a noun. Those. Substituting the combination of name you can get a fairly accurate definition of gender (male, female). Super! The implementation of the function was not long in coming. Everything is done in the form of templates in the mailing list.

With the help of a clever design of declension:
{{|}}/{%% %%} 

As a result, the output will be either “Dear” or “Dear”.
')
The contents of the structure can be arbitrary. Let us explain in the given example:


Here is another example of the design:
 {{|}}/{%% %%} %{}% 

=> the result will be “Dear Ivan” or “Dear Margherita” or “Dear Customer” (if the name is not specified)

For those who use our online editor, it's even easier:
image

Convenient links in the control panel by clicking on the button on the upper right, which you see in the screenshot above.

To write a similar wrapper is really not difficult. The performance of the module is amazing and allows you to use such a definition of sex and autosubstitution pattern “on the fly” in the process of sending mailings without losing speed.

And the advantages for our customers are obvious:


Therefore, if you have the task of “living” work with texts, the declension of various words and phrases, working with numerals, then Sergey’s library will help you! Thank you so much for her!

PS Our service has an exclusive use of this library in email marketing services in Russia. We will be glad if this function becomes really necessary and useful for our clients.

Source: https://habr.com/ru/post/233763/


All Articles