프로그래밍 언어별로 사용할 수 있는 라이브러리를 제공해?
응. PHP, Python, Node.js, Java, Go, Ruby, Rust, Perl, .NET용 공식 API 클라이언트를 제공해. 전부 여기에서 찾을 수 있어. API는 일반 JSON을 반환하니까 어떤 언어에서든 직접 호출할 수도 있어. API를 시작하려면 코드 예제를 살펴봐:
먼저 composer로 우리 라이브러리를 설치해 줘:
composer require gender-api/client
<?php
use GenderApi\Client as GenderApiClient;
$client = new GenderApiClient('your-api-key');
// Simple gender lookup
$result = $client->getByFirstName('Elisabeth');
if ($result->genderFound()) {
echo $result->getGender(); // "female"
echo $result->getAccuracy(); // 99
}
// First name with country (e.g., "Andrea" varies by country)
$result = $client->getByFirstNameAndCountry('Andrea', 'IT');
echo $result->getGender(); // "male" (in Italy)
// Full name with automatic first/last name splitting
$result = $client->getByFirstNameAndLastName('Sandra Miller');
echo $result->getFirstName(); // "Sandra"
echo $result->getLastName(); // "Miller"
echo $result->getGender(); // "female"
// Email address analysis
$result = $client->getByEmailAddress('elisabeth.smith@company.com');
echo $result->getGender(); // "female"
// Batch processing - multiple names in one call
$names = ['Michael', 'Sarah', 'Kim'];
$results = $client->getByMultipleNames($names);
foreach ($results as $result) {
printf(
"%s: %s (%d%% confidence)\n",
$result->getFirstName(),
$result->getGender(),
$result->getAccuracy()
);
}
전체 클라이언트 문서는 여기에서 확인해 줘:
연관 키워드
이 글이 도움이 됐어?