Get random first/last name
Project description
randname
Python module to generate random name.
Summary
Randname is a python module for generating random name - first and last. It uses official data from appropiate governmant/scientific reserch centers.
Names are drawn with the consideration of their frequency. Therefor moste common name wil be drawn much more often (this feature can be disabled).
Currently supported cuntries: US, PL, ES.
Default database is small, and constrained to 10000 records for each first and last names for every country. Default data size: 60 000 records
With the full database downloaded from project github page, the amount of names is increased to around 700 000 records.
Table of Contents
- Project Title
- Summary
- Table of Contents
- Installation
- Usage
- Documentation
- Database
- Contribution
- Authors & Contributors
- To Do
- License
Installation
Randnames is availabe in python repository, and can be downloaded with pip.
pip3 install rname
Usage
>>> import randname
# Get name
>>> randname.get_name("first")
'John'
>>> randname.get_name("last")
'Doe'
# Get first name
>>> randname.first_name()
'John'
# Get last name
>>> randname.last_name()
'Doe'
# Get full name
>>>randname.full_name()
'John Doe'
# Setting dirrection to external database
>>> randname.database_path = "/path/to/external/database/"
Documentation
Detailed documentation of module can by found here: randname documentation
Database
Default database included in pypi package is very small. To not make the package unnecessary too large, every country have one set of data for last and first names (with distinction for the male, female, neutral name), for the most recent year. Each file contains up to 10000 records.
Currently supprted countries:
US:
- 2010, last names (neutral)
- 2018, first names (male, female)
PL:
- 2020, last names (male, female)
- 2021, first names (male, female)
ES:
- 2020, last names (male)
- 2020, first names (male)
Biger database
Full database is bigger and doesn't have the limit of records. If you wan to use it, dowload it from project github page.
To use other databases specify directory by setting database_path
variable
>>> import randnames
>>> randnames.database_path = "path_to_your_database"
More details about database can be found here
Contribution
If you want to contribute to randname projcet read contribution for more information.
I am looking especially for help with database creation. More information on how to help/create appropiate data files with names can be found in database guide
Authors & Contributors
Author: Adam Walkiewicz
Contributors: Be first!
To do
- Summary
- Tools
- Contribution guideline
- Unit tests
- Instruction for database creation
- Add equal chances for every name
- Support for other countries names
- Add 9 more countries
License
Randnames is licensed under the terms of the MIT license
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rname-0.3.7.tar.gz
.
File metadata
- Download URL: rname-0.3.7.tar.gz
- Upload date:
- Size: 728.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a5d4dc0a948a82f9a04ea080a5577119651b3d76a7642ba92e0111ff63d1be4 |
|
MD5 | 985391beeb1049fdd488eaa715d63013 |
|
BLAKE2b-256 | 63317159cde2d74e8c2890a03439cae691eb3c007bfada93a4910983c973e29b |
File details
Details for the file rname-0.3.7-py3-none-any.whl
.
File metadata
- Download URL: rname-0.3.7-py3-none-any.whl
- Upload date:
- Size: 727.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e0bcde8f8cec0560ffa743a91effa7a58ca5e5a30aa025da28d35a2ffdde7e2 |
|
MD5 | 6368cc21812c8d1375d90b162a7fee53 |
|
BLAKE2b-256 | 5e46c115296e1f9ca83e844c1362094ef6dd96c2320282a6a7dbaee2360bcb1d |