namegender 0.5.0 → 0.7.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 +60 -0
- data/lib/namegender.rb +49 -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: 658d4fb7a91170b0e2b2c61f23f172b259192bca6308113674e874057aa0adc1
|
|
4
|
+
data.tar.gz: a1272df8391d88b717b26494bf79bc16bbbc4c51a3db6bec6016177d8572828c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c83e850168ffcdfdd3ad530f59df0cb3db34dbf6a7159e6bc9bdd230156bbb2343192b79701d42a1f2420c0bff379b9cf7c84cba7436a5bec2ffc532c1c14876
|
|
7
|
+
data.tar.gz: bb93bcc96d6651dd39e0bfe25a0c4464db382e5c310f3879160f8c747a468840b2e8cd8f7b60da17ea0e93d411e02f70da2b2be72a7160111595eba614ecfe2d
|
data/README.md
CHANGED
|
@@ -53,6 +53,66 @@ 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
|
+
|
|
87
|
+
## Name check
|
|
88
|
+
|
|
89
|
+
Whether a name typed into a form looks like a real person's name, with the
|
|
90
|
+
reasons. It never calls a name fake: use it to flag records for a closer look,
|
|
91
|
+
not to reject people automatically.
|
|
92
|
+
|
|
93
|
+
```ruby
|
|
94
|
+
result = client.name_check("asdf qwerty")
|
|
95
|
+
puts result["assessment"] # implausible
|
|
96
|
+
puts result["score"] # 0 (0-100)
|
|
97
|
+
result["signals"].each { |s| puts "#{s["code"]} #{s["severity"]} #{s["part"]}" } # keyboard_pattern high first_name, ...
|
|
98
|
+
|
|
99
|
+
client.name_check("Jennifer Null")["assessment"] # plausible
|
|
100
|
+
|
|
101
|
+
# Names stored in separate fields are used as they are, not parsed:
|
|
102
|
+
client.name_check(first_name: "Jennifer", last_name: "Null", country: "US")
|
|
103
|
+
|
|
104
|
+
result = client.name_check_bulk(["Jennifer Null", "asdf qwerty"])
|
|
105
|
+
puts result["summary"] # total, plausible, suspicious, implausible
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
One credit per name. `assessment` is `"plausible"`, `"suspicious"` or
|
|
109
|
+
`"implausible"`; each signal has `code`, `severity` (`high`, `medium`, `low`,
|
|
110
|
+
`info`, `positive`), `part` and `value` (either can be `nil`). `evidence`
|
|
111
|
+
says whether the first name is counted, attested or not found. Surnames are
|
|
112
|
+
judged by their shape only. It takes `country:`, `locale:` and `ip:`, not
|
|
113
|
+
`best_guess` or `ai_fallback`. `name_check_bulk` takes up to 100 names and
|
|
114
|
+
returns `results` in input order.
|
|
115
|
+
|
|
56
116
|
## File jobs
|
|
57
117
|
|
|
58
118
|
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,55 @@ 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
|
|
83
|
+
# Whether a name typed into a form looks like a real person's name, with
|
|
84
|
+
# reasons. It never calls a name fake: use it to flag records for a look,
|
|
85
|
+
# not to reject people automatically. "assessment" is "plausible",
|
|
86
|
+
# "suspicious" or "implausible", "score" is 0-100, and "signals" lists
|
|
87
|
+
# why ({"code", "severity", "part", "value"}; "part" and "value" can be
|
|
88
|
+
# nil). Surnames are judged by their shape only. `value` is the full name;
|
|
89
|
+
# pass `first_name:` and `last_name:` instead when they are stored
|
|
90
|
+
# separately (they are not parsed). `country`, `locale` and `ip` work as
|
|
91
|
+
# in #name. One credit per name. `best_guess`, `ai_fallback` and
|
|
92
|
+
# `language` do not apply here and are not accepted.
|
|
93
|
+
def name_check(value = nil, first_name: nil, last_name: nil, country: nil, locale: nil, ip: nil)
|
|
94
|
+
post("/name-check", {
|
|
95
|
+
name: value, first_name: first_name, last_name: last_name, country: country, locale: locale, ip: ip
|
|
96
|
+
}.compact)
|
|
97
|
+
end
|
|
98
|
+
# Up to 100 names; every option applies to all of them. "results" keeps
|
|
99
|
+
# the input order, "summary" counts the plausible, suspicious and
|
|
100
|
+
# implausible names.
|
|
101
|
+
def name_check_bulk(values, country: nil, locale: nil, ip: nil)
|
|
102
|
+
post("/name-check/bulk", { names: Array(values), country: country, locale: locale, ip: ip }.compact)
|
|
103
|
+
end
|
|
55
104
|
def account
|
|
56
105
|
request(Net::HTTP::Get, "/me")
|
|
57
106
|
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.7.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, salutation and name check lookups through NameGender.
|
|
15
15
|
email:
|
|
16
16
|
- support@namegender.com
|
|
17
17
|
executables: []
|