2017 © Pedro Peláez
 

library php_genderize

Genderize.io handler for PHP

image

barttyrant/php_genderize

Genderize.io handler for PHP

  • Tuesday, August 23, 2016
  • by barttyrant
  • Repository
  • 3 Watchers
  • 17 Stars
  • 4,421 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 11 Forks
  • 4 Open issues
  • 1 Versions
  • 11 % Grown

The README.md

php_genderize

PHP5 lib for handling genderize.io gender recognition, (*1)

Basicaly, it's for guessing the gender by a given first name and using genderize.io., (*2)

Author: Bart Tyrant bartlomiej@tyranowski.pl Contributors: Luke Shaheen @tlshaheen http://github.com/tlshaheen License: The MIT License http://www.opensource.org/licenses/mit-license.php, (*3)

==Usage:==, (*4)

The simplest case:, (*5)

$recognizer = new \Genderize\Base\Recognizer('Peter');

$peter = $recognizer->recognize();
print_r($peter);

will give:, (*6)

Genderize\Base\Name Object ( [_name:protected] => Peter [_count:protected] => 4284 [_gender:protected] => male [_probability:protected] => 1.00 ), (*7)

You can pass multiple names - at time of writing, genderizer.io accepts up to 10 at once, (*8)

$recognizer = new \Genderize\Base\Recognizer(array('Peter', 'John'));

$namesinfo = $recognizer->recognize();
print_r($namesinfo);

will give:, (*9)

array([0] => Genderize\Base\Name Object ( [_name:protected] => Peter [_count:protected] => 4284 [_gender:protected] => male [_probability:protected] => 1.00 ), [1] => Genderize\Base\Name Object ( [_name:protected] => Peter [_count:protected] => 4284 [_gender:protected] => male [_probability:protected] => 1.00 ) ), (*10)

--, (*11)

Also, country and language filters are supported:, (*12)

$Recognizer = Genderize::factory();

$asia = $Recognizer->set_name('Asia')->recognize();
print_r($asia);

$asiaPL = $Recognizer->set_country_id('pl')->set_name('Asia')->recognize();
print_r($asiaPL);

... will print out:, (*13)

Genderize\Base\Name Object ( [_name:protected] => Asia [_count:protected] => 97 [_gender:protected] => female [_probability:protected] => 0.99 ) Genderize\Base\Name Object ( [_name:protected] => Asia [_count:protected] => 26 [_gender:protected] => female [_probability:protected] => 1.00 [_country_id] => PL ), (*14)

Have an API key from http://store.genderize.io? Use $Recognizer->set_api_key($api_key) to pass it with the request., (*15)

The Versions

23/08 2016

dev-master

9999999-dev

Genderize.io handler for PHP

  Sources   Download

The Requires

  • php >=5.3.0

 

by Bartek Tyranowski