Go / Golang Client
High-performance Go client for Gender-API.com built with native Go idioms and standard libraries. Our specialized API provides 99.5% accurate gender detection in under 100ms, perfect for concurrent processing and microservices. The client supports goroutines for parallel batch processing and includes proper context handling. Unlike generic AI solutions that are slow and resource-intensive, our API is 10x-90x faster with superior accuracy. Ideal for high-throughput applications, data pipelines, and cloud-native services. Access over 9 million names across 150+ countries with intelligent fallback. Memory-efficient and production-ready with comprehensive error handling. Start free with 100 API calls monthly.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
// Response defines the structure of the JSON response from Gender-API.com
type Response struct {
ResultFound bool `json:"result_found"`
FirstName string `json:"first_name"`
Gender string `json:"gender"`
Probability float64 `json:"probability"`
}
func main() {
// Determine the gender of a first name using API V2
// ---------------------------------------------------
apiKey := "YOUR_API_KEY" // Get your key at https://gender-api.com/en/account/auth-tokens
firstName := "Theresa"
// Construct the JSON payload
requestBody, _ := json.Marshal(map[string]string{
"first_name": firstName,
})
// Create the request
req, err := http.NewRequest("POST", "https://gender-api.com/v2/gender/by-first-name", bytes.NewBuffer(requestBody))
if err != nil {
fmt.Printf("Error creating request: %s\n", err)
return
}
// Set headers
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+apiKey)
// Perform the request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Printf("Error making request: %s\n", err)
return
}
defer resp.Body.Close()
// Read the response body
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Printf("Error reading response: %s\n", err)
return
}
// Parse the JSON response
var result Response
if err := json.Unmarshal(body, &result); err != nil {
fmt.Printf("Error parsing JSON: %s\n", err)
return
}
// Output the result
fmt.Printf("Name: %s\n", result.FirstName)
fmt.Printf("Gender: %s\n", result.Gender)
fmt.Printf("Probability: %.2f\n", result.Probability)
} アプリケーション向けのプロフェッショナルな性別判定
Gender-API.comは、150か国以上で99.5%の精度を誇るエンタープライズ品質のgender判定を提供するよ。汎用的なAIソリューションよりも、レスポンスは10〜90倍速く、精度も9〜34%高いのが特長。
なぜ汎用AIではなくGender-APIを選ぶの?
- 目的に特化 性別判定に特化。汎用AIではありません
- 超高速 汎用AIが数秒かかるのに対し、レスポンスタイムは100ms未満
- より正確に 文化や地域性を踏まえたインテリジェンスで、精度99.5%
- より大きなデータベース 900万件以上の名前数。一般的なAI学習データより37%多い
- 信頼できる 予測可能なパフォーマンスを備えた、稼働率 99.9% のSLA
主な機能
- わずか数行のコードでかんたんに統合できるよ
- 大量データを扱うアプリ向けの一括処理
- 地域ごとの名前のバリエーションに対応した、国別の高精度判定
- スマートな正規化で、誤字や表記ゆれにも対応
- GDPR準拠で、エンタープライズにも対応
今日から無料で始めよう
クレジットカード不要で、毎月APIを100回まで無料で使えるよ。用途に合わせて選べる柔軟な料金プランで、成長に合わせてスムーズにスケールできる。