Skip to main content

faker2 - fork of Faker with 100-language (Whisper) locale coverage and large name pools for PII pseudonymization.

Project description

CI Coverage PyPI version Supported Python versions License: MIT

faker2 is a fork of joke2k/Faker — the reference Python library for generating fake data — extended for one specific job: pseudonymizing personally identifiable information (PII) in speech and text datasets, in every language a speech model transcribes.

Install it alongside upstream Faker if you want — the import name is faker2, so both can coexist:

pip install faker2

from faker2 import Faker
Faker("ml_IN").name()   # ശ്രീദേവി വാസുദേവൻ

The upstream project’s own README is kept, unmodified, as README.upstream.rst.


Why this fork exists

We build multilingual ASR and PII-redaction models at Gladia. Training data must be pseudonymized: every real person and company name is replaced by a plausible surrogate, in the same language and script as the source text. Upstream Faker is excellent, but it was not designed for that use case, and three gaps blocked us:

  1. Missing languages. Whisper transcribes 100 languages; upstream Faker ships a person provider for only 56 of them. A Malayalam or Amharic transcript had no locale to draw surrogates from, so names either leaked through or were replaced by Latin-script placeholders — both unacceptable.

  2. Name pools too small for dataset scale. Pseudonymizing a corpus draws tens of thousands of surrogates. ja_JP ships 51 given names: 223 Japanese person entities could only yield 50 distinct surrogates, so the same fake name recurred dozens of times. A NER model trained on that data memorizes the surrogate list instead of learning the pattern — the dataset teaches the wrong thing.

  3. Company names collapsing. Several locales had two or three company suffixes and a single format, so a few hundred draws produced barely a hundred distinct companies — the same memorization problem, for organizations.

None of this is a criticism of upstream: generating a handful of fake records for a test fixture — Faker’s core use case — has entirely different requirements from generating a hundred thousand surrogates that a neural network will then train on.

What this fork adds

48 new locales — person + company providers with authentic native-script data, bringing coverage to all 100 Whisper languages:

af_ZA am_ET as_IN ba_RU be_BY bo_CN br_FR bs_BA cy_GB eu_ES fo_FO gl_ES haw_US ht_HT jw_ID kk_KZ km_KH kn_IN la lb_LU ln_CD lo_LA mg_MG mi_NZ ml_IN mn_MN ms_MY mt_MT my_MM oc_FR pa_IN ps_AF sa_IN sd_PK si_LK sn_ZW so_SO sq_AL sr_RS su_ID te_IN tg_TJ tk_TM tl_PH tt_RU ur_PK yi_DE yue_HK

Larger given-name pools where upstream’s were too small for dataset-scale pseudonymization: ja_JP 51 → 160, ko_KR 121 → 186, pl_PL 153 → 205, plus 120+ entries per list across the new locales.

Diversity-hardened company providers: a sector component was added to eight locales whose output space was collapsing, lifting unique-company ratios from 65–79 % to 94–97 % over 300 draws.

Tests that check what matters for this use case — 288 of them, on top of upstream’s suite (2 742 passing in total):

  • names are emitted in the expected script (a Malayalam locale must not produce Latin names);

  • pool sizes stay above the memorization threshold;

  • ≥ 85 % unique full names over 400 seeded draws, ≥ 70 % unique companies;

  • ja_JP kana/romaji completeness;

  • every Whisper language resolves to a working locale.

Merged upstream pull requests that were open and unreleased — mostly IBAN/bank correctness fixes (uk_UA, ru_RU, no_NO, nl_BE, en_IE, pt_BR, da_DK, es_ES, en_IN/es_MX/zh_CN), the en_IN company / IFSC / license-plate providers, and a choices_distribution IndexError fix.

Relationship with upstream

  • All credit for Faker goes to joke2k and its contributors. This fork exists to add locales and scale properties — not to replace or compete with the original project. If you do not need the above, use upstream Faker: pip install Faker.

  • The fork tracks upstream master, keeps its MIT license and its architecture unchanged; new locales follow the project’s exact provider conventions.

  • Locale contributions made here are intended to be offered back upstream where they fit the project’s scope.

  • faker2 uses its own import name (faker2), so it can be installed side by side with upstream Faker in the same environment.

Usage

Identical to upstream — see the Faker documentation. The only difference is the set of available locales:

from faker2 import Faker

Faker("yue_HK").name()      # 陳嘉敏
Faker("sr_RS").name()       # Милена Чолић
Faker("am_ET").company()    # company name in Ge'ez script

Pseudonymization tip — seed per source item so the mapping is reproducible without storing any real→fake table:

import hashlib
from faker2 import Faker

def surrogate(original: str, text: str, locale: str) -> str:
    seed = int(hashlib.sha1(f"{text}\0{original}".encode()).hexdigest()[:12], 16)
    fake = Faker(locale)
    fake.seed_instance(seed)
    return fake.name()

License

MIT, unchanged from upstream. See LICENSE.txt.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faker2-40.28.1.post1.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faker2-40.28.1.post1-py3-none-any.whl (2.2 MB view details)

Uploaded Python 3

File details

Details for the file faker2-40.28.1.post1.tar.gz.

File metadata

  • Download URL: faker2-40.28.1.post1.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for faker2-40.28.1.post1.tar.gz
Algorithm Hash digest
SHA256 8585ee73139a1c8c092445ca59eae87b5630d84d0114628c7bf0787603f15633
MD5 ed4966e4a3dacb9b0d79bf3b0ecfba49
BLAKE2b-256 d313253b4a302ea2048d566fd2d669fc32f2ec7bd42afbcbcc80e8a98c26b4ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for faker2-40.28.1.post1.tar.gz:

Publisher: publish.yml on jqueguiner/faker2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file faker2-40.28.1.post1-py3-none-any.whl.

File metadata

  • Download URL: faker2-40.28.1.post1-py3-none-any.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for faker2-40.28.1.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 3357070afcffaf602f9f311011729674b09c578738f2f1e746b69faa4d66784d
MD5 10c6b4cc910a81d2593ad9e4bb8103a2
BLAKE2b-256 2c4bc43328130f0f6dce4ecc57fea79dcdc41597f8235198e07a08abfd472507

See more details on using hashes here.

Provenance

The following attestation bundles were made for faker2-40.28.1.post1-py3-none-any.whl:

Publisher: publish.yml on jqueguiner/faker2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page