|
| 1 | +# faker2 — fork with name intelligence + a Rust port |
| 2 | + |
| 3 | +This fork of [faker2](README.upstream.rst) adds three things on top of upstream: |
| 4 | + |
| 5 | +1. **Name intelligence** (`faker2/naming/`) — gender inference, gender-preserving |
| 6 | + name replacement, and English grammatical-number agreement. |
| 7 | +2. **A real name ground-truth dataset** (`data/`) — 1.43M first names across 139 |
| 8 | + countries with gender + relative frequency, as Parquet. |
| 9 | +3. **A Rust port** (`rust/`) — the core engine + key providers + the same name |
| 10 | + intelligence, re-implemented in Rust. |
| 11 | + |
| 12 | +Upstream faker docs: [`README.upstream.rst`](README.upstream.rst). |
| 13 | + |
| 14 | +## Repository layout |
| 15 | + |
| 16 | +``` |
| 17 | +faker2/ Python package (upstream faker fork) |
| 18 | + naming/ ← added: name intelligence |
| 19 | + gender.py gender infer + preserving replace (bundled locales) |
| 20 | + realnames.py same, backed by data/ ground truth (needs pyarrow) |
| 21 | + grammar.py pluralize / singularize / agreement |
| 22 | +data/ ← added: name ground truth |
| 23 | + first_names.parquet 1.43M names, 139 countries, gender, relative frequency |
| 24 | + last_names.parquet small sample (surnames NOT comprehensive) |
| 25 | + README.md schema + provenance |
| 26 | +rust/ ← added: Rust port |
| 27 | + src/ engine, providers, gender, grammar, realnames |
| 28 | + README.md crate docs |
| 29 | +tests/ Python tests (incl. test_gender_grammar.py) |
| 30 | +``` |
| 31 | + |
| 32 | +## Python — name intelligence |
| 33 | + |
| 34 | +```python |
| 35 | +from faker2.naming import realnames, grammar |
| 36 | + |
| 37 | +realnames.infer_gender("Jacques", "FR") # "m" |
| 38 | +realnames.first_name_like("Jacques", "FR") # frequency-weighted male FR name |
| 39 | +realnames.first_name("JP", "f") # weighted female Japanese name |
| 40 | + |
| 41 | +grammar.pluralize("baby") # "babies" |
| 42 | +grammar.agree(3, "dog") # "3 dogs" |
| 43 | +``` |
| 44 | + |
| 45 | +`realnames` needs `pyarrow` (in `dev-requirements.txt`). The bundled-locale |
| 46 | +variant `faker2.naming.gender` has no extra dependency. |
| 47 | + |
| 48 | +## Rust port |
| 49 | + |
| 50 | +``` |
| 51 | +cd rust |
| 52 | +cargo test # zero-dependency core |
| 53 | +cargo run -- --seed 42 name |
| 54 | +cargo run -- like Jacques fr # gender-preserving replacement |
| 55 | +cargo test --features real-names # opt-in parquet ground truth |
| 56 | +``` |
| 57 | + |
| 58 | +See [`rust/README.md`](rust/README.md). |
| 59 | + |
| 60 | +## Data provenance |
| 61 | + |
| 62 | +The name dataset was extracted from a PostgreSQL dump and normalized so |
| 63 | +`frequency` is a **relative share** — no raw population counts are exposed. See |
| 64 | +[`data/README.md`](data/README.md). |
0 commit comments