namegender 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +31 -0
- data/lib/namegender.rb +28 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4643c981f5be9a9a9e2e4ebd41d812b466c1e740918d01374daf75c9d1e60ae
|
|
4
|
+
data.tar.gz: b46fa7433ebbae2738c127a4b1446d13d1fa14f98ec3369ad3c6ac7184d1b316
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2fcce41ef6af0dab6bb88560310d56d8573d8f2267b95a3b9c669818f679f7b63a1b0f27dd9d77ec329d651b3f14a879d7eaae30f7a58cd5283165f15328e54b
|
|
7
|
+
data.tar.gz: 8a072d1a84da3868b1d170f98b8c90e7210716f91737fb9f3fb30515e50b166706c3d5801edf94e5a63010273beef31143fbe2c3e3da679a5065d35672ba2f3a
|
data/README.md
CHANGED
|
@@ -53,6 +53,37 @@ result["registrations"].each { |r| puts "#{r["country"]} #{r["share"]}%" }
|
|
|
53
53
|
puts result["attested_in"].join(", ")
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
## Salutation
|
|
57
|
+
|
|
58
|
+
A ready-to-use salutation for a letter or an email, in `en`, `de`, `fr`, `es`,
|
|
59
|
+
`it`, `pt`, `nl`, `tr`, `pl` or `ja` (and regional variants such as `de-AT`
|
|
60
|
+
or `pt-BR`). Without `language:` it follows `locale:`, then the country, then
|
|
61
|
+
English.
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
result = client.salutation("Dr. Anna Müller", language: "de")
|
|
65
|
+
puts result["salutation"]["formal"] # Sehr geehrte Frau Dr. Müller,
|
|
66
|
+
puts result["salutation"]["informal"] # Liebe Anna,
|
|
67
|
+
|
|
68
|
+
client.salutation("Ahmet Yılmaz", language: "tr")["salutation"]["formal"] # Sayın Ahmet Bey,
|
|
69
|
+
|
|
70
|
+
# Names stored in separate fields are used as they are, not parsed:
|
|
71
|
+
client.salutation(first_name: "Anna", last_name: "Müller", title: "Dr.", language: "de")
|
|
72
|
+
|
|
73
|
+
result = client.salutation_bulk(["Dr. Anna Müller", "Müller GmbH"], language: "de")
|
|
74
|
+
result["results"].each { |r| puts r["salutation"]["formal"] }
|
|
75
|
+
puts result["summary"] # total, gendered, neutral, organization
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
One credit per name. When the gender is not certain enough (`min_probability:`,
|
|
79
|
+
default 90), you get the neutral form rather than a guess: `form` is
|
|
80
|
+
`"gendered"`, `"neutral"` or `"organization"`, and `reason` says why it is not
|
|
81
|
+
gendered (`"gender_unknown"`, `"below_min_probability"`, ...). `best_guess`
|
|
82
|
+
does not apply here. If you already know the gender, pass
|
|
83
|
+
`gender: "female"`, `"male"` or `"neutral"`. `salutation_bulk` takes up to 100
|
|
84
|
+
names and returns `results` in input order. An unsupported language raises
|
|
85
|
+
`NameGender::Error` with status 422 and `body["supported"]`.
|
|
86
|
+
|
|
56
87
|
## File jobs
|
|
57
88
|
|
|
58
89
|
Upload a CSV or XLSX file (up to 100 MB and 1,000,000 rows) and get it back
|
data/lib/namegender.rb
CHANGED
|
@@ -52,6 +52,34 @@ module NameGender
|
|
|
52
52
|
def countries(value, limit: nil)
|
|
53
53
|
post("/gender/countries", { name: value, limit: limit }.compact)
|
|
54
54
|
end
|
|
55
|
+
# A salutation for a letter or an email: "Sehr geehrte Frau Dr. Müller,",
|
|
56
|
+
# "Sayın Ahmet Bey,". `value` is the full name, titles included; pass
|
|
57
|
+
# `first_name:` and `last_name:` instead when they are stored separately
|
|
58
|
+
# (they are not parsed). `language` defaults to the language of `locale`,
|
|
59
|
+
# then the main language of the country, then "en"; an unsupported one is
|
|
60
|
+
# a 422. `gender:` ("male", "female", "neutral") is a known gender and
|
|
61
|
+
# skips the lookup; `min_probability:` (50-100, server default 90) is the
|
|
62
|
+
# certainty below which the neutral form is used; `title:` is an academic
|
|
63
|
+
# title kept in a separate field ("Dr."). "form" and "reason" in the result
|
|
64
|
+
# say why a neutral form was chosen. One credit per name. `best_guess` and
|
|
65
|
+
# `ai_fallback` do not apply here and are not accepted.
|
|
66
|
+
def salutation(value = nil, first_name: nil, last_name: nil, language: nil, country: nil, locale: nil, ip: nil,
|
|
67
|
+
gender: nil, min_probability: nil, title: nil)
|
|
68
|
+
post("/salutation", {
|
|
69
|
+
name: value, first_name: first_name, last_name: last_name, language: language, country: country,
|
|
70
|
+
locale: locale, ip: ip, gender: gender, min_probability: min_probability, title: title
|
|
71
|
+
}.compact)
|
|
72
|
+
end
|
|
73
|
+
# Up to 100 names; every option applies to all of them. "results" keeps
|
|
74
|
+
# the input order, "summary" counts the gendered, neutral and organization
|
|
75
|
+
# forms.
|
|
76
|
+
def salutation_bulk(values, language: nil, country: nil, locale: nil, ip: nil, gender: nil, min_probability: nil,
|
|
77
|
+
title: nil)
|
|
78
|
+
post("/salutation/bulk", {
|
|
79
|
+
names: Array(values), language: language, country: country, locale: locale, ip: ip, gender: gender,
|
|
80
|
+
min_probability: min_probability, title: title
|
|
81
|
+
}.compact)
|
|
82
|
+
end
|
|
55
83
|
def account
|
|
56
84
|
request(Net::HTTP::Get, "/me")
|
|
57
85
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: namegender
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- NameGender
|
|
@@ -10,8 +10,8 @@ bindir: bin
|
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2026-10-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description: A dependency-free Ruby client for name, email, username, bulk
|
|
14
|
-
distribution lookups through NameGender.
|
|
13
|
+
description: A dependency-free Ruby client for name, email, username, bulk, country
|
|
14
|
+
distribution and salutation lookups through NameGender.
|
|
15
15
|
email:
|
|
16
16
|
- support@namegender.com
|
|
17
17
|
executables: []
|