Skip to content

AusIV/names

 
 

Repository files navigation

names

image

image

image

image

Random name generator

Installation

The script is available on PyPI. To install with pip:

pip install names

Usage

Names can be used as a command line utility or imported as a Python package.

Command Line Usage

To use the script from the command line:

$ names
John Powell

Python Package Usage

Here are examples of all current features:

>>> import names
>>> names.get_full_name()
u'Patricia Halford'
>>> names.get_full_name(gender='male')
u'Patrick Keating'
>>> names.get_first_name()
'Bernard'
>>> names.get_first_name(gender='female')
'Christina'
>>> names.get_last_name()
'Szczepanek'

Bulk Name Generation

If you're generating a large volume of names, the bulk names module will be more memory intensive, but faster. To use this module, simply replace:

>>> import names

with

>>> import names.bulk as names

and it will cache all of the names into memory, instead of going to the files for each lookup. For example:

>>> import names.bulk as names
>>> names.get_full_name()
u'Patricia Halford'
>>> names.get_full_name(gender='male')
u'Patrick Keating'
>>> names.get_first_name()
'Bernard'
>>> names.get_first_name(gender='female')
'Christina'
>>> names.get_last_name()
'Szczepanek'

License

This project is released under an MIT License.

Data in the following files are public domain (derived from 1990 Census data):

  • dist.all.last
  • dist.female.first
  • dist.male.first

About

Random name generator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.3%
  • Shell 0.7%