Gender
This API tries to determine what the gender of a person is based on their name and a database of over 90,000 entries tagged with their reported genders.
We recommend using this API in combination with the Names API.
Prediction labels
Limits
The maximum length accepted is 512 characters.
Emotion | Example |
---|---|
male | Pedro, Louis |
female | Helen, Jenny |
unknown | Dog, Tree |
Invokation
- cURL
- Python
- PHP
curl -L -G 'http://api.textkit.ai/detect/gender' \
--data-urlencode 'text=Thomas Alba Edison' \
--header 'X-API-Key: your_api_key_here'
import requests
url = "https://api.textkit.ai/detect/gender?text=Thomas Alba Edison"
payload={}
headers = {
'X-API-Key': 'your_api_key_here'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
<?php
$curl = curl_init();
$url = "https://api.textkit.ai/detect/gender?text=" . urlencode("Thomas Alba Edison");
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'X-API-Key: your_api_key_here'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Response
{
"prediction": "male",
"confidence": "0.67",
"time_ms": 7
}
Field | Meaning |
---|---|
prediction | The predicted label. See above for reference |
confidence | Value between 0 and 1 that indicates how confident the model is |
time_ms | Time in milliseconds the model took to predict the label. It does not account for the network round trip time between request and response |