Optional
apiKey: stringOutputs information about the current state of the rate limit. Updated and cached
each time [[predict
]] is called. If no information is available, for example because
[[predict
]] has not been executed yet, null
is returned. Otherwise the response is
of type [[GenderizeLimit
]].
Predict a single name
import Genderize from '@sebbo2002/genderize';
const genderize = new Genderize('API-KEY');
genderize.predict('Mia').then(result => {
console.log(result);
});
{
name: 'Mia',
gender: 'female',
probability: 0.96,
count: 19266
}
Predict multiple names. Works for up to 10 names at the same time.
Please check this list if you're unsure about the country code you have to use.
It is recommended to check the count of the response when using localization. If the count is very low or gender is null, you can fallback to a request with no localization.
import Genderize from '@sebbo2002/genderize';
const genderize = new Genderize('API-KEY');
genderize.predict(['Noah', 'Evelyn']).then(result => {
console.log(result);
});
[
{ name: 'Noah', gender: 'male', probability: 0.88, count: 3939 },
{ name: 'Evelyn', gender: 'female', probability: 0.98, count: 12188 }
]
Predict a single name with a given ISO 3166-1 alpha-2 country code
import Genderize from '@sebbo2002/genderize';
const genderize = new Genderize('API-KEY');
genderize.predict('Mia', 'DE').then(result => {
console.log(result);
});
{
name: 'Mia',
gender: 'female',
probability: 0.97,
count: 1786,
country_id: 'DE'
}
Predict multiple names with a given ISO 3166-1 alpha-2 country code. Works for up to 10 names at the same time.
Please check this list if you're unsure about the country code you have to use.
It is recommended to check the count of the response when using localization. If the count is very low or gender is null, you can fallback to a request with no localization.
import Genderize from '@sebbo2002/genderize';
const genderize = new Genderize('API-KEY');
genderize.predict(['Noah', 'Evelyn'], 'DE').then(result => {
console.log(result);
});
[
{ name: 'Noah', gender: 'male', probability: 1, count: 608, country_id: 'DE' },
{ name: 'Evelyn', gender: 'female', probability: 0.97, count: 1665, country_id: 'DE' }
]
Usually you get an
Genderize
instance like this:You can get an API key from store.genderize.io.
If you don't have an API key yet, you can start with the free plan: