Determine gender of firstnames

目录

简介

类摘要

Gender\Gender

class Gender\Gender {

/* Constants */

const integer Gender\Gender::IS_FEMALE = 70 ;

const integer Gender\Gender::IS_MOSTLY_FEMALE = 102 ;

const integer Gender\Gender::IS_MALE = 77 ;

const integer Gender\Gender::IS_MOSTLY_MALE = 109 ;

const integer Gender\Gender::IS_UNISEX_NAME = 63 ;

const integer Gender\Gender::IS_A_COUPLE = 67 ;

const integer Gender\Gender::NAME_NOT_FOUND = 32 ;

const integer Gender\Gender::ERROR_IN_NAME = 69 ;

const integer Gender\Gender::ANY_COUNTRY = 0 ;

const integer Gender\Gender::BRITAIN = 1 ;

const integer Gender\Gender::IRELAND = 2 ;

const integer Gender\Gender::USA = 3 ;

const integer Gender\Gender::SPAIN = 4 ;

const integer Gender\Gender::PORTUGAL = 5 ;

const integer Gender\Gender::ITALY = 6 ;

const integer Gender\Gender::MALTA = 7 ;

const integer Gender\Gender::FRANCE = 8 ;

const integer Gender\Gender::BELGIUM = 9 ;

const integer Gender\Gender::LUXEMBOURG = 10 ;

const integer Gender\Gender::NETHERLANDS = 11 ;

const integer Gender\Gender::GERMANY = 12 ;

const integer Gender\Gender::EAST_FRISIA = 13 ;

const integer Gender\Gender::AUSTRIA = 14 ;

const integer Gender\Gender::SWISS = 15 ;

const integer Gender\Gender::ICELAND = 16 ;

const integer Gender\Gender::DENMARK = 17 ;

const integer Gender\Gender::NORWAY = 18 ;

const integer Gender\Gender::SWEDEN = 19 ;

const integer Gender\Gender::FINLAND = 20 ;

const integer Gender\Gender::ESTONIA = 21 ;

const integer Gender\Gender::LATVIA = 22 ;

const integer Gender\Gender::LITHUANIA = 23 ;

const integer Gender\Gender::POLAND = 24 ;

const integer Gender\Gender::CZECH_REP = 25 ;

const integer Gender\Gender::SLOVAKIA = 26 ;

const integer Gender\Gender::HUNGARY = 27 ;

const integer Gender\Gender::ROMANIA = 28 ;

const integer Gender\Gender::BULGARIA = 29 ;

const integer Gender\Gender::BOSNIA = 30 ;

const integer Gender\Gender::CROATIA = 31 ;

const integer Gender\Gender::KOSOVO = 32 ;

const integer Gender\Gender::MACEDONIA = 33 ;

const integer Gender\Gender::MONTENEGRO = 34 ;

const integer Gender\Gender::SERBIA = 35 ;

const integer Gender\Gender::SLOVENIA = 36 ;

const integer Gender\Gender::ALBANIA = 37 ;

const integer Gender\Gender::GREECE = 38 ;

const integer Gender\Gender::RUSSIA = 39 ;

const integer Gender\Gender::BELARUS = 40 ;

const integer Gender\Gender::MOLDOVA = 41 ;

const integer Gender\Gender::UKRAINE = 42 ;

const integer Gender\Gender::ARMENIA = 43 ;

const integer Gender\Gender::AZERBAIJAN = 44 ;

const integer Gender\Gender::GEORGIA = 45 ;

const integer Gender\Gender::KAZAKH_UZBEK = 46 ;

const integer Gender\Gender::TURKEY = 47 ;

const integer Gender\Gender::ARABIA = 48 ;

const integer Gender\Gender::ISRAEL = 49 ;

const integer Gender\Gender::CHINA = 50 ;

const integer Gender\Gender::INDIA = 51 ;

const integer Gender\Gender::JAPAN = 52 ;

const integer Gender\Gender::KOREA = 53 ;

/* 方法 */

public bool connect ( string $dsn )

public __construct ([ string $dsn ] )

public array country ( int $country )

public int get ( string $name [, int $country ] )

public array isNick ( string $name0 , string $name1 [, int $country ] )

public array similarNames ( string $name [, int $country ] )

}

预定义常量

Gender\Gender::IS_FEMALE

Gender\Gender::IS_MOSTLY_FEMALE

Gender\Gender::IS_MALE

Gender\Gender::IS_MOSTLY_MALE

Gender\Gender::IS_UNISEX_NAME

Gender\Gender::IS_A_COUPLE

Gender\Gender::NAME_NOT_FOUND

Gender\Gender::ERROR_IN_NAME

Gender\Gender::ANY_COUNTRY

Gender\Gender::BRITAIN

Gender\Gender::IRELAND

Gender\Gender::USA

Gender\Gender::SPAIN

Gender\Gender::PORTUGAL

Gender\Gender::ITALY

Gender\Gender::MALTA

Gender\Gender::FRANCE

Gender\Gender::BELGIUM

Gender\Gender::LUXEMBOURG

Gender\Gender::NETHERLANDS

Gender\Gender::GERMANY

Gender\Gender::EAST_FRISIA

Gender\Gender::AUSTRIA

Gender\Gender::SWISS

Gender\Gender::ICELAND

Gender\Gender::DENMARK

Gender\Gender::NORWAY

Gender\Gender::SWEDEN

Gender\Gender::FINLAND

Gender\Gender::ESTONIA

Gender\Gender::LATVIA

Gender\Gender::LITHUANIA

Gender\Gender::POLAND

Gender\Gender::CZECH_REP

Gender\Gender::SLOVAKIA

Gender\Gender::HUNGARY

Gender\Gender::ROMANIA

Gender\Gender::BULGARIA

Gender\Gender::BOSNIA

Gender\Gender::CROATIA

Gender\Gender::KOSOVO

Gender\Gender::MACEDONIA

Gender\Gender::MONTENEGRO

Gender\Gender::SERBIA

Gender\Gender::SLOVENIA

Gender\Gender::ALBANIA

Gender\Gender::GREECE

Gender\Gender::RUSSIA

Gender\Gender::BELARUS

Gender\Gender::MOLDOVA

Gender\Gender::UKRAINE

Gender\Gender::ARMENIA

Gender\Gender::AZERBAIJAN

Gender\Gender::GEORGIA

Gender\Gender::KAZAKH_UZBEK

Gender\Gender::TURKEY

Gender\Gender::ARABIA

Gender\Gender::ISRAEL

Gender\Gender::CHINA

Gender\Gender::INDIA

Gender\Gender::JAPAN

Gender\Gender::KOREA

Gender\Gender::connect

Connect to an external name dictionary

说明

public bool Gender\Gender::connect ( string $dsn )

Connect to an external name dictionary. Currently only streams are supported.

参数

dsn
DSN to open.

返回值

Boolean as success of failure.

Gender\Gender::__construct

Construct the Gender object

说明

public Gender\Gender::__construct ([ string $dsn ] )

Create a Gender object optionally connecting to an external name dictionary. When no external database was given, compiled in data will be used.

参数

dsn
DSN to open.

返回值

Gender\Gender::country

Get textual country representation

说明

public array Gender\Gender::country ( int $country )

Returns the textual representation of a country from a Gender class constant.

参数

country
A country ID specified by a Gender\Gender class constant.

返回值

Returns an array with the short and full names of the country on success 或者在失败时返回 FALSE.

范例

示例 #1 Using Gender\Gender::country

$gender = new Gender\Gender;
var_dump($gender->country(Gender\Gender::BRITAIN));

以上例程会输出:

array(2) {
  'country_short' =>
  string(2) "UK"
  'country' =>
  string(13) "Great Britain"
}

Gender\Gender::get

Get gender of a name

说明

public int Gender\Gender::get ( string $name [, int $country ] )

Get the gender of the name in a particular country.

参数

name
Name to check.

country
Country id identified by Gender class constant.

返回值

Returns gender of the name.

Gender\Gender::isNick

Check if the name0 is an alias of the name1

说明

public array Gender\Gender::isNick ( string $name0 , string $name1 [, int $country ] )

Check whether the name0 is a nick of the name1.

参数

name0
Name to check.

name1
Name to check.

country
Country id identified by Gender class constant. If ommited ANY_COUNTRY is used.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

Gender\Gender::similarNames

Get similar names

说明

public array Gender\Gender::similarNames ( string $name [, int $country ] )

Get similar names for the given name and country.

参数

name
Name to check.

country
Country id identified by Gender class constant. If ommited ANY_COUNTRY is used.

返回值

Returns an array with the similar names found.