Skip to content

Instantly share code, notes, and snippets.

@wonhyeongseo
Created June 22, 2023 15:47
Show Gist options
  • Save wonhyeongseo/3448ddf86ed09037fc6252c0a76feea0 to your computer and use it in GitHub Desktop.
Save wonhyeongseo/3448ddf86ed09037fc6252c0a76feea0 to your computer and use it in GitHub Desktop.
Using namechart.kr to deduce gender of a Korean name
import requests
url = 'https://api.namechart.kr/search?query='
def gender(name) -> tuple:
response = requests.get(f"{url}{name}", verify=False)
if response.status_code == 200:
data = response.json()
# contains female/male/total counts and
# resulting prediction based on trend as 'trendGender'
count = data['match']['count']
return 'F' if count['female'] > count['male'] else 'M'
else :
print(response.status_code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment