PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Peter Kahl   Gender Universal   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Gender Universal
Detect person gender name in multiple languages
Author: By
Last change: Update of README.md
Date: 4 years ago
Size: 1,688 bytes
 

Contents

Class file image Download

Gender Universal

Detects gender from person's name, capable to analyse strings in these scripts: Latin, Cyrillic, Hanzi (Kanji).

Dependencies

Usage

use peterkahl\GenderUniversal\GenderUniversal;

$gendObj = new GenderUniversal;

#-------------------------------
# French (Latin) name
$gendObj->firstName = 'Gaétan';
$gendObj->lastName  = '';         # Surname is irrelevant (in this case)
$gendObj->country   = 'FR';       # Country code may be helpful

echo $gendObj->getGender(); # M

#-------------------------------
# Russian (Cyrillic) name
$gendObj->firstName = '????';
$gendObj->lastName  = '????????'; # Surname may be helpful
$gendObj->country   = '';

echo $gendObj->getGender(); # F

#-------------------------------
# Chinese (Hanzi) name
$gendObj->firstName = '??';      # Make sure this is only given name (not surname)
$gendObj->lastName  = '';         # Surname is irrelevant (in this case)
$gendObj->country   = '';         # Country code is irrelevant (in this case)

echo $gendObj->getGender(); # M

#-------------------------------
# Japanese (Kanji) name
$gendObj->firstName = '??';      # Make sure this is only given name (not surname)
$gendObj->lastName  = '';         # Surname is irrelevant (in this case)
$gendObj->country   = '';         # Country code is irrelevant (in this case)

echo $gendObj->getGender(); # M