This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.URLEncoder; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.methods.HttpGet; | |
import org.apache.http.impl.client.DefaultHttpClient; | |
/** | |
* Predict Gender from a Personal name | |
* @param firstName The given name | |
* @param lastName The family name | |
* @return Double in range -1 (male) .. +1 (female) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Jean Smith is more likely a female name in the US | |
wget -q -O - http://api.onomatic.com/onomastics/api/gendre/Jean/Smith/us | |
0.9 | |
# Jean Valjean is a male name in France | |
wget -q -O - http://api.onomatic.com/onomastics/api/gendre/Jean/Valjean/fr | |
-1.0 | |
# Olga Sokolova is a female name | |
wget -q -O - http://api.onomatic.com/onomastics/api/gendre/Olga/Sokolova |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use hammock from https://github.com/kadirpekel/hammock | |
from hammock import Hammock as GendreAPI | |
gendre = GendreAPI("http://api.namsor.com/onomastics/api/json/gendre") | |
# example call to GendRE API, will automatically recognize country/culture and return gender | |
resp = gendre('Jean','Parker').GET() | |
print (resp.json().get('gender')) | |
# returns: female | |
# gendre('Jean','Marchand') would return 'male' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Submit the form using AJAX. | |
$.ajax({ | |
type: 'GET', | |
url: 'https://api.namsor.com/onomastics/api/json/gender/John/Smith', | |
//contentType: 'text/json', | |
xhrFields: { | |
// The 'xhrFields' property sets additional fields on the XMLHttpRequest. | |
// This can be used to set the 'withCredentials' property. | |
// Set the value to 'true' if you'd like to pass cookies to the server. | |
// If this is enabled, your server must respond with the header |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Submit the form using AJAX. | |
$.ajax({ | |
type: 'GET', | |
url: 'https://api.namsor.com/onomastics/api/json/origin/Elena/Rossini', | |
//contentType: 'text/json', | |
xhrFields: { | |
// The 'xhrFields' property sets additional fields on the XMLHttpRequest. | |
// This can be used to set the 'withCredentials' property. | |
// Set the value to 'true' if you'd like to pass cookies to the server. | |
// If this is enabled, your server must respond with the header |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import time | |
import openapi_client | |
from openapi_client.rest import ApiException | |
from pprint import pprint | |
# Configure API key authorization: api_key | |
configuration = openapi_client.Configuration() | |
configuration.api_key['X-API-KEY'] = '<your API key>' | |
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(namsor) | |
setwd("D:/Sync/Dropbox/NamSor_CarmenAguilarGarcia/") | |
names<-read.csv("combine.csv",header = F) | |
str(names) | |
names$V1<-as.character(names$V1) | |
names$V2<-as.character(names$V2) | |
names$V3<-as.character(names$V3) | |