Skip to content

NamSor API v2 GO golang SDK - classify personal names accurately by gender, country of origin, or ethnicity.

License

Notifications You must be signed in to change notification settings

namsor/namsor-golang-sdk2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for namsorapi

NamSor API v2 : enpoints to process personal names (gender, cultural origin or ethnicity) in all alphabets or languages. By default, enpoints use 1 unit per name (ex. Gender), but Ethnicity classification uses 10 to 20 units per name depending on taxonomy. Use GET methods for small tests, but prefer POST methods for higher throughput (batch processing of up to 100 names at a time). Need something you can't find here? We have many more features coming soon. Let us know, we'll do our best to add it!

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.0.15
  • Package version: 2.0.15
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit http://www.namsor.com/

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./namsorapi"

Documentation for API Endpoints

All URIs are relative to https://v2.namsor.com/NamSorAPIv2

Class Method HTTP request Description
AdminApi Anonymize Get /api2/json/anonymize/{source}/{anonymized} Activate/deactivate anonymization for a source.
AdminApi ApiStatus Get /api2/json/apiStatus Prints the current status of the classifiers. A classifier name in apiStatus corresponds to a service name in apiServices.
AdminApi ApiUsage Get /api2/json/apiUsage Print current API usage.
AdminApi ApiUsageHistory Get /api2/json/apiUsageHistory Print historical API usage.
AdminApi ApiUsageHistoryAggregate Get /api2/json/apiUsageHistoryAggregate Print historical API usage (in an aggregated view, by service, by day/hour/min).
AdminApi AvailableServices Get /api2/json/apiServices List of classification services and usage cost in Units per classification (default is 1=ONE Unit). Some API endpoints (ex. Corridor) combine multiple classifiers.
AdminApi Disable Get /api2/json/disable/{source}/{disabled} Activate/deactivate an API Key.
AdminApi Learnable Get /api2/json/learnable/{source}/{learnable} Activate/deactivate learning from a source.
AdminApi SoftwareVersion Get /api2/json/softwareVersion Get the current software version
AdminApi TaxonomyClasses Get /api2/json/taxonomyClasses/{classifierName} Print the taxonomy classes valid for the given classifier.
ChineseApi ChineseNameCandidates Get /api2/json/chineseNameCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin} Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming
ChineseApi ChineseNameCandidatesBatch Post /api2/json/chineseNameCandidatesBatch Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
ChineseApi ChineseNameCandidatesGenderBatch Post /api2/json/chineseNameCandidatesGenderBatch Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname) ex. Wang Xiaoming.
ChineseApi ChineseNameGenderCandidates Get /api2/json/chineseNameGenderCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin}/{knownGender} Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming - having a known gender ('male' or 'female')
ChineseApi ChineseNameMatch Get /api2/json/chineseNameMatch/{chineseSurnameLatin}/{chineseGivenNameLatin}/{chineseName} Return a score for matching Chinese name ex. 王晓明 with a romanized name ex. Wang Xiaoming
ChineseApi ChineseNameMatchBatch Post /api2/json/chineseNameMatchBatch Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
ChineseApi GenderChineseName Get /api2/json/genderChineseName/{chineseName} Infer the likely gender of a Chinese full name ex. 王晓明
ChineseApi GenderChineseNameBatch Post /api2/json/genderChineseNameBatch Infer the likely gender of up to 100 full names ex. 王晓明
ChineseApi GenderChineseNamePinyin Get /api2/json/genderChineseNamePinyin/{chineseSurnameLatin}/{chineseGivenNameLatin} Infer the likely gender of a Chinese name in LATIN (Pinyin).
ChineseApi GenderChineseNamePinyinBatch Post /api2/json/genderChineseNamePinyinBatch Infer the likely gender of up to 100 Chinese names in LATIN (Pinyin).
ChineseApi ParseChineseName Get /api2/json/parseChineseName/{chineseName} Infer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name)
ChineseApi ParseChineseNameBatch Post /api2/json/parseChineseNameBatch Infer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name).
ChineseApi PinyinChineseName Get /api2/json/pinyinChineseName/{chineseName} Romanize the Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name)
ChineseApi PinyinChineseNameBatch Post /api2/json/pinyinChineseNameBatch Romanize a list of Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name).
GeneralApi NameType Get /api2/json/nameType/{properNoun} Infer the likely type of a proper noun (personal name, brand name, place name etc.)
GeneralApi NameTypeBatch Post /api2/json/nameTypeBatch Infer the likely common type of up to 100 proper nouns (personal name, brand name, place name etc.)
GeneralApi NameTypeGeo Get /api2/json/nameTypeGeo/{properNoun}/{countryIso2} Infer the likely type of a proper noun (personal name, brand name, place name etc.)
GeneralApi NameTypeGeoBatch Post /api2/json/nameTypeGeoBatch Infer the likely common type of up to 100 proper nouns (personal name, brand name, place name etc.)
JapaneseApi GenderJapaneseNameFull Get /api2/json/genderJapaneseNameFull/{japaneseName} Infer the likely gender of a Japanese full name ex. 王晓明
JapaneseApi GenderJapaneseNameFullBatch Post /api2/json/genderJapaneseNameFullBatch Infer the likely gender of up to 100 full names
JapaneseApi GenderJapaneseNamePinyin Get /api2/json/genderJapaneseName/{japaneseSurname}/{japaneseGivenName} Infer the likely gender of a Japanese name in LATIN (Pinyin).
JapaneseApi GenderJapaneseNamePinyinBatch Post /api2/json/genderJapaneseNameBatch Infer the likely gender of up to 100 Japanese names in LATIN (Pinyin).
JapaneseApi JapaneseNameGenderKanjiCandidatesBatch Post /api2/json/japaneseNameGenderKanjiCandidatesBatch Identify japanese name candidates in KANJI, based on the romanized name (firstName = japaneseGivenName; lastName=japaneseSurname) with KNOWN gender, ex. Yamamoto Sanae
JapaneseApi JapaneseNameKanjiCandidates Get /api2/json/japaneseNameKanjiCandidates/{japaneseSurnameLatin}/{japaneseGivenNameLatin}/{knownGender} Identify japanese name candidates in KANJI, based on the romanized name ex. Yamamoto Sanae - and a known gender.
JapaneseApi JapaneseNameKanjiCandidates1 Get /api2/json/japaneseNameKanjiCandidates/{japaneseSurnameLatin}/{japaneseGivenNameLatin} Identify japanese name candidates in KANJI, based on the romanized name ex. Yamamoto Sanae
JapaneseApi JapaneseNameKanjiCandidatesBatch Post /api2/json/japaneseNameKanjiCandidatesBatch Identify japanese name candidates in KANJI, based on the romanized name (firstName = japaneseGivenName; lastName=japaneseSurname), ex. Yamamoto Sanae
JapaneseApi JapaneseNameLatinCandidates Get /api2/json/japaneseNameLatinCandidates/{japaneseSurnameKanji}/{japaneseGivenNameKanji} Romanize japanese name, based on the name in Kanji.
JapaneseApi JapaneseNameLatinCandidatesBatch Post /api2/json/japaneseNameLatinCandidatesBatch Romanize japanese names, based on the name in KANJI
JapaneseApi JapaneseNameMatch Get /api2/json/japaneseNameMatch/{japaneseSurnameLatin}/{japaneseGivenNameLatin}/{japaneseName} Return a score for matching Japanese name in KANJI ex. 山本 早苗 with a romanized name ex. Yamamoto Sanae
JapaneseApi JapaneseNameMatchBatch Post /api2/json/japaneseNameMatchBatch Return a score for matching a list of Japanese names in KANJI ex. 山本 早苗 with romanized names ex. Yamamoto Sanae
JapaneseApi JapaneseNameMatchFeedbackLoop Get /api2/json/japaneseNameMatchFeedbackLoop/{japaneseSurnameLatin}/{japaneseGivenNameLatin}/{japaneseName} [CREDITS 1 UNIT] Feedback loop to better perform matching Japanese name in KANJI ex. 山本 早苗 with a romanized name ex. Yamamoto Sanae
JapaneseApi ParseJapaneseName Get /api2/json/parseJapaneseName/{japaneseName} Infer the likely first/last name structure of a name, ex. 山本 早苗 or Yamamoto Sanae
JapaneseApi ParseJapaneseNameBatch Post /api2/json/parseJapaneseNameBatch Infer the likely first/last name structure of a name, ex. 山本 早苗 or Yamamoto Sanae
PersonalApi Corridor Get /api2/json/corridor/{countryIso2From}/{firstNameFrom}/{lastNameFrom}/{countryIso2To}/{firstNameTo}/{lastNameTo} [USES 20 UNITS PER NAME COUPLE] Infer several classifications for a cross border interaction between names (ex. remit, travel, intl com)
PersonalApi CorridorBatch Post /api2/json/corridorBatch [USES 20 UNITS PER NAME PAIR] Infer several classifications for up to 100 cross border interaction between names (ex. remit, travel, intl com)
PersonalApi Country Get /api2/json/country/{personalNameFull} [USES 10 UNITS PER NAME] Infer the likely country of residence of a personal full name, or one surname. Assumes names as they are in the country of residence OR the country of origin.
PersonalApi CountryBatch Post /api2/json/countryBatch [USES 10 UNITS PER NAME] Infer the likely country of residence of up to 100 personal full names, or surnames. Assumes names as they are in the country of residence OR the country of origin.
PersonalApi Diaspora Get /api2/json/diaspora/{countryIso2}/{firstName}/{lastName} [USES 20 UNITS PER NAME] Infer the likely ethnicity/diaspora of a personal name, given a country of residence ISO2 code (ex. US, CA, AU, NZ etc.)
PersonalApi DiasporaBatch Post /api2/json/diasporaBatch [USES 20 UNITS PER NAME] Infer the likely ethnicity/diaspora of up to 100 personal names, given a country of residence ISO2 code (ex. US, CA, AU, NZ etc.)
PersonalApi Gender Get /api2/json/gender/{firstName}/{lastName} Infer the likely gender of a name.
PersonalApi GenderBatch Post /api2/json/genderBatch Infer the likely gender of up to 100 names, detecting automatically the cultural context.
PersonalApi GenderFull Get /api2/json/genderFull/{fullName} Infer the likely gender of a full name, ex. John H. Smith
PersonalApi GenderFullBatch Post /api2/json/genderFullBatch Infer the likely gender of up to 100 full names, detecting automatically the cultural context.
PersonalApi GenderFullGeo Get /api2/json/genderFullGeo/{fullName}/{countryIso2} Infer the likely gender of a full name, given a local context (ISO2 country code).
PersonalApi GenderFullGeoBatch Post /api2/json/genderFullGeoBatch Infer the likely gender of up to 100 full names, with a given cultural context (country ISO2 code).
PersonalApi GenderGeo Get /api2/json/genderGeo/{firstName}/{lastName}/{countryIso2} Infer the likely gender of a name, given a local context (ISO2 country code).
PersonalApi GenderGeoBatch Post /api2/json/genderGeoBatch Infer the likely gender of up to 100 names, each given a local context (ISO2 country code).
PersonalApi Origin Get /api2/json/origin/{firstName}/{lastName} [USES 10 UNITS PER NAME] Infer the likely country of origin of a personal name. Assumes names as they are in the country of origin. For US, CA, AU, NZ and other melting-pots : use 'diaspora' instead.
PersonalApi OriginBatch Post /api2/json/originBatch [USES 10 UNITS PER NAME] Infer the likely country of origin of up to 100 names, detecting automatically the cultural context.
PersonalApi ParseName Get /api2/json/parseName/{nameFull} Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
PersonalApi ParseNameBatch Post /api2/json/parseNameBatch Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
PersonalApi ParseNameGeo Get /api2/json/parseName/{nameFull}/{countryIso2} Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. For better accuracy, provide a geographic context.
PersonalApi ParseNameGeoBatch Post /api2/json/parseNameGeoBatch Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. Giving a local context improves precision.
PersonalApi UsRaceEthnicity Get /api2/json/usRaceEthnicity/{firstName}/{lastName} [USES 10 UNITS PER NAME] Infer a US resident's likely race/ethnicity according to US Census taxonomy W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
PersonalApi UsRaceEthnicityBatch Post /api2/json/usRaceEthnicityBatch [USES 10 UNITS PER NAME] Infer up-to 100 US resident's likely race/ethnicity according to US Census taxonomy. Output is W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
PersonalApi UsRaceEthnicityZIP5 Get /api2/json/usRaceEthnicityZIP5/{firstName}/{lastName}/{zip5Code} [USES 10 UNITS PER NAME] Infer a US resident's likely race/ethnicity according to US Census taxonomy, using (optional) ZIP5 code info. Output is W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
PersonalApi UsZipRaceEthnicityBatch Post /api2/json/usZipRaceEthnicityBatch [USES 10 UNITS PER NAME] Infer up-to 100 US resident's likely race/ethnicity according to US Census taxonomy, with (optional) ZIP code. Output is W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
SocialApi PhoneCode Get /api2/json/phoneCode/{firstName}/{lastName}/{phoneNumber} [USES 11 UNITS PER NAME] Infer the likely country and phone prefix, given a personal name and formatted / unformatted phone number.
SocialApi PhoneCodeBatch Post /api2/json/phoneCodeBatch [USES 11 UNITS PER NAME] Infer the likely country and phone prefix, of up to 100 personal names, detecting automatically the local context given a name and formatted / unformatted phone number.
SocialApi PhoneCodeGeo Get /api2/json/phoneCodeGeo/{firstName}/{lastName}/{phoneNumber}/{countryIso2} [USES 11 UNITS PER NAME] Infer the likely phone prefix, given a personal name and formatted / unformatted phone number, with a local context (ISO2 country of residence).
SocialApi PhoneCodeGeoBatch Post /api2/json/phoneCodeGeoBatch [USES 11 UNITS PER NAME] Infer the likely country and phone prefix, of up to 100 personal names, with a local context (ISO2 country of residence).
SocialApi PhoneCodeGeoFeedbackLoop Get /api2/json/phoneCodeGeoFeedbackLoop/{firstName}/{lastName}/{phoneNumber}/{phoneNumberE164}/{countryIso2} [CREDITS 1 UNIT] Feedback loop to better infer the likely phone prefix, given a personal name and formatted / unformatted phone number, with a local context (ISO2 country of residence).

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
	Key: "APIKEY",
	Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

Author

contact@namsor.com