Russian Names
russiannames is a Python 3 library dedicated to parse Russian names, surnames and midnames, identify person gender by fullname and how name is written. It uses an embedded DuckDB engine over bundled Parquet datasets to speed-up name parsing — no database server required.
Documentation
Usage and API documentation lives in this README (see the sections below).
Installation
Install the library with pip:
pip install russiannames
The reference datasets (Parquet files) are bundled with the package, so no
external database, download, or restore step is needed. NamesParser() works out
of the box.
To use your own datasets, point the library at a directory containing
names.parquet, surnames.parquet and midnames.parquet via either the
NamesParser(data_dir=...) argument or the RUSSIANNAMES_DATA_DIR environment
variable.
Features
Bundled Parquet datasets used for identification
- 375449 surnames - dataset: surnames.parquet
- 32134 first names - dataset: names.parquet
- 48274 midnames - dataset: midnames.parquet
Detailed database statistics by gender and collection
| collection | total | males | females | universal or unidentified |
|---|---|---|---|---|
| names | 32134 | 19297 | 8278 | 4559 |
| midnames | 48274 | 30114 | 16143 | 2017 |
| surnames | 375449 | 124662 | 111534 | 139253 |
Supports 12 formats of Russian full names writing style
| Format | Example | Description |
|---|---|---|
| f | Ольга | only first name |
| s | Петров | only surname |
| Fs | О. Сидорова | first letter of first name and full surname |
| sF | Николаев С. | full surname and first letter of surname |
| sf | Абрамов Семен | full surname and full first name |
| fs | Соня Камиуллина | full first name and full surname |
| fm | Иван Петрович | full first name and full middlename |
| SFM | М.Д.М. | first letters of surname, first name, middlename |
| FMs | А.Н. Егорова | first letters of first and middle name and full furname |
| sFM | Николаенко С.П. | full surname and first letters of first and middle names |
| sfM | Петракова Зинаида М. | full surname, first name and first letter of middle name |
| sfm | Казаков Ринат Артурович | full name as surname, first name and middle name |
| fms | Светлана Архиповна Волкова | full name as first name, middle name and surname |
Supports names with following ethnics identification
9 ethnic types in names, surnames and middle names supported
| key | name (en) | name (rus) |
|---|---|---|
| arab | Arabic | Арабское |
| arm | Armenian | Армянское |
| geor | Georgian | Грузинское |
| germ | German | Немецкие |
| greek | Greek | Греческие |
| jew | Jew | Еврейские |
| polsk | Polish | Польские |
| slav | Slavic (Russian) | Славянские |
| tur | Turkic | Тюркские (тюркоязычные) |
Limitations
- very rare names, surnames or middlenames could be not parsed
- ethnic identification is still on early stage
Speed optimization
- datasets are loaded into an in-memory DuckDB database and indexed on the
lookup key (
text) for fast exact-match queries
Usage and Examples
Parse name and identify gender
Parses names and returns: format, surname, first name, middle name, parsed (True/False) and gender
>>> from russiannames.parser import NamesParser
>>> parser = NamesParser()
>>> parser.parse('Нигматуллин Ринат Ахметович')
{'format': 'sfm', 'sn': 'Нигматуллин', 'fn': 'Ринат', 'mn': 'Ахметович', 'gender': 'm', 'text': 'Нигматуллин Ринат Ахметович', 'parsed': True}
>>> parser.parse('Петрова C.Я.')
{'format': 'sFM', 'sn': 'Петрова', 'fn_s': 'C', 'mn_s': 'Я', 'gender': 'f', 'text': 'Петрова C.Я.', 'parsed': True}
Gender field could have one of following values:
- m: Male
- f: Female
- u: Unknown / unidentified
- -: Impossible to identify
Command line
rusnames "Нигматуллин Ринат Ахметович"
Ethnic identification (experimental)
Parses surname, first name and middle name and tries to identify person ethic affiliation of the person
>>> from russiannames.parser import NamesParser
>>> parser = NamesParser()
>>> parser.classify('Нигматуллин', 'Ринат', 'Ахметович')
{'ethnics': ['tur'], 'gender': 'm'}
>>> parser.classify('Алексеева', 'Ольга', 'Ивановна')
{'ethnics': ['slav'], 'gender': 'f'}
Supported languages
- Russian
Requirements
- Python 3.9+
- duckdb
Related projects
- Slavic names https://github.com/wb-08/SlavicNames - same data shipped as SQLite database
Metadata
Release files for russiannames 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| russiannames-2.0.0.tar.gz | 5.8 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| russiannames-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 MB
Release files / russiannames-2.0.0.tar.gz
| Download URL | russiannames-2.0.0.tar.gz |
|---|---|
| Size | 5.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7daca8e2e62e29eedc57a8017ea1a585a0fa1537cd1ab92cd3de52a4b9fdc76a
|
|
BLAKE2b-256 checksum How to use checksums |
419b8b004ecd0f3ed1ce9a0f178e055cf58b9617e62167122f539be1f0d35076
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / russiannames-2.0.0-py3-none-any.whl
| Download URL | russiannames-2.0.0-py3-none-any.whl |
|---|---|
| Size | 5.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd1380103cd43742ce30b2f840a8c589a2f72b4739e09e30777f566c3af0c221
|
|
BLAKE2b-256 checksum How to use checksums |
3150067b5d0f2775b59983afcbaa4db8132bb901459579c895f4b9c56d805d5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for russiannames 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.