{ "info": { "author": "Neil Freeman", "author_email": "contact@fakeisthenewreal.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "Census Name\n===========\n\nGenerate random names based on US Census data, or files that you\nprovide.\n\nBasic use\n~~~~~~~~~\n\nThe simplest way to use censusname is with the ``generate`` method. It\ngenerates a names based on last and first name distributions in the 2000\nCensus. It has a 50/50 chance of providing a first name from either the\n``female`` or ``male`` lists.\n\n.. code:: python\n\n import censusname\n censusname.generate()\n 'Jane Smith'\n\nOr, on the command line, run:\n\n::\n\n python -m censusname\n\nThe simplest way to customize Censusname is with the name\\_format\nargument It takes a string with two formatting keys: 'given' and\n'surname' (The format should look familiar from Python's\n`str.format `__\nbuiltin).\n\n.. code:: python\n\n import censusname\n\n # Generate first names\n censusname.generate(nameformat='{given}')\n 'Linda'\n\n # Generate names in last, first format\n censusname.generate(nameformat='{surname}, {given')\n 'Nguyen, Pamela'\n\nMethods and Objects\n~~~~~~~~~~~~~~~~~~~\n\n``generate``\n^^^^^^^^^^^^\n\nGenerates random names. See below for details on valid arguments.\n\n``Censusname``\n^^^^^^^^^^^^^^\n\nThe ``generate`` method is called on a default instance of the\n``Censusname`` object. ``Censusname`` is the meat of the module, and\ninstances a can be created with custom formatting and custom lists of\nnames.\n\nKeyword arguments: ``nameformat``, ``namefiles``, ``max_frequencies``,\n``formatters``, ``capitalize``.\n\n.. code:: python\n\n from censusname import Censusname\n\n last_first = Censusname(nameformat='{surname}, {given}')\n last_first.generate()\n 'Lashley, Emily'\n\n``Censusname.generate``\n^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n C = Censusname()\n C.generate()\n 'Michael Fox'\n\n # Add the same middle initial to all names\n C.generate(nameformat='{given} J. {surname}')\n 'Michael J. Fox'\n\nEach part of the name is also a keyword argument. The default data set\nincludes given name files broken up into male and female names. The\nmodule can be told to always use a certain file:\n\n.. code:: python\n\n C.generate(given='female')\n 'Caroline Dippold'\n\nSince the argument to ``nameformat`` is passed to Str.format, one can\nuse any string formatting options, like padding:\n\n.. code:: python\n\n C.generate(nameformat='{given:10}', given='male')\n 'Charles '\n\nThe default dataset in censusname gives all names totally capitalized,\nand censusname changes them to title case. This can be turned off with a\nthe capitalize argument, which works for both ``Censusname`` and\n``Censusname.generate``:\n\n.. code:: python\n\n C.generate(capitalize=False)\n 'WES REAVES'\n\n # or, create your own Censusname object\n from censusname import Censusname\n C = Censusname(capitalize=False)\n C.generate()\n 'JOSE PETRIE'\n\nYes, it's a bit strange for ``capitalize=False`` to result in uppercase\nnames. The false omits\n`str.capitalize `__,\nso the default capitalization from the raw data shines through, which\nhappens to be all uppercase. You can customize the module arbitrary\nreformatting methods. Read on!\n\nAdvanced\n~~~~~~~~\n\nYou can pass your own names file to ``Censusname`` to generate names\nwith arbitary formatting. For each section of a name, a different sets\nof files can be used. This could be useful if you have name data broken\ndown by time, geography, or any other variable. By default, male and\nfemale first name data from 1990 are combined with last name data from\n2000.\n\nFiles must have two fields: ``name`` and ``cumulative_frequency``. By\ndefault, the package expects comma-delimited files, buy you can pass in\n``csv.DictReader`` arguments with the paramenter ``csv_args``.\n\nThe ``cumulative_frequency`` field should be calculated based on\nascending frequency, and should be a number between from 0 to and some\nmaximum - see the discussion of ``max_frequencies`` below.\n\nBy default, the name generator looks at separate lists of male and\nfemale names. You can specify lists for arbitrary groupings of names.\nLet's say you have name distribution data for two provinces in Spain. In\nSpain, two surnames are used: the paternal and maternal, so you have\nfour files total for surnames, as well as general files for male and\nfemale first names.\n\n.. code:: python\n\n my_files = {\n 'given': {\n 'male': 'given-male.txt',\n 'female': 'given-female.txt'\n },\n 'paternal': {\n 'sevilla': 'paternal-sevilla.txt',\n 'toledo': 'paternal-toledo.txt'\n },\n 'maternal': {\n 'sevilla': 'maternal-sevilla.txt',\n 'toledo': 'maternal-toledo.txt'\n }\n }\n\n # Perhaps you want to specify arguments to csv.DictReader, which will be reading the files\n my_csv_args = {\n # Any arguments that can be passed to DictReader\n }\n\nThe US Census names files don't contain every name, only those that\ncover about 90% of the population. With that in mind, ``random_name``\ncan take a ``max_frequencies`` argument to give these maximums. We\nspecify these maximum with a dictionary whose keys are the file names.\nIf you give custom files but no ``max_frequencies``, 100 will be used.\n(The max frequencies are hard coded for the default files.)\n\n.. code:: python\n\n # These are made-up numbers. Perhaps you prefer percentages:\n maximums = {\n 'given-male.txt': 89.7,\n 'maternal-sevilla.txt': 90.4,\n # etc\n }\n\n # Or, you have a file where frequencies go from 0 to 1:\n maximums = {\n 'given-male.txt': 0.897,\n 'maternal-sevilla.txt': 0.904,\n # etc\n }\n\nAlso, we want to use a standard conjuction in the name:\n\n.. code:: python\n\n my_format = '{given} {paternal} y {maternal}'\n\nGenerating names with these examples:\n\n.. code:: python\n\n from censusname import Censusname\n\n espana_nombre = Censusname(nameformat=my_format, namefiles=my_files, max_frequencies=maximums, csv_args=my_csv_args)\n\n # Generate a name of the format 'Given Paternal y Maternal'\n espana_nombre.generate()\n 'Luis de G\u00f3ngora y Argote'\n\n # Use a different format:\n espana_nombre.generate(nameformat='{given} {paternal} de {maternal}')\n 'Pedro L\u00f3pez de Ayala'\n\n # Pick a name from the Sevilla files:\n espana_nombre.generate(maternal='sevilla', paternal='sevilla')\n\n # Pick a female name from the Toledo files:\n # Note that any of the keys in my_files can be used as keyword arguments. The values should be keys from the respective dictionary.\n espana_nombre.generate(given='female', maternal='toledo', paternal='toledo')\n\n # By default, names are capitalized (title case).\n # Generate a name using given capitalization in the files:\n espana_nombre.generate(capitalize=False)\n\n # By default, there's an equal probability of producing a name with a part from the Sevilla or Toledo lists.\n # You have to do a little extra to weight that probability.\n # Specify an 75% chance of a sevilla name, 25% chance of a toledo name:\n province = random.choice(['sevilla'] * 3 + ['toledo'])\n espana_nombre.generate(paternal=province, maternal=province)\n\nExample: Middle Names\n~~~~~~~~~~~~~~~~~~~~~\n\nUse the built-in data to fake middle names by randomly picking either a\nfirst or last name:\n\n.. code:: python\n\n import censusname\n\n namefiles = censusname.NAMEFILES\n\n # Add a middle name entry to the name files\n namefiles['middle'] = {\n 'last': censusname.SURNAME2000,\n 'female': censusname.FEMALEFIRST1990,\n 'male': censusname.MALEFIRST1990\n }\n\n middlenames = censusname.Censusname(namefiles, censusname.MAX_FREQUENCIES, '{given} {middle} {surname}')\n\n # Generate a name in the format \"given, middle, surname\"\n # However, this might return unlikely names\n middlenames.generate()\n 'John Mary Smith'\n\n # Generated name will have a male first name and either a male given name or a surname as a middle name\n middlenames.generate(given='male', middle=['male', 'last'])\n 'Charles Michael Brescia'\n\n # Generated name will have a female first name and either a female given name or a surname as a middle name\n middlenames.generate(given='female', middle=['female', 'last'])\n 'Mildred Hoang Hutton'\n\nFormatters\n^^^^^^^^^^\n\nYou can specify arbitary reformatting methods that are run on each part\nof the name before they are returned. By default, the package includes a\nsurname formatter that tries to intelligently format raw names like\nOHALLORAN (to O'Halloran).\n\nYou can specify formatters with a dict that targets each part of a name.\nThe formatters should be a list of methods.\n\n.. code:: python\n\n\n my_formatters = {\n 'given': [lambda x: x[::-1]], # reverse a string\n 'surname': [lambda x: \"De \" + x],\n }\n\n cn = Censusname(formatters=my_formatters)\n cn.generate()\n 'ekiM De Morgan'\n\nAdditional formatters can be added to ``Censusname.generate``, they will\nbe run in addition to any formatters included in the object.\n\n.. code:: python\n\n more_formatters = {\n 'given': [lambda x: x.replace('a', 'b')]\n }\n\n cn.generate(formatters=more_formatters)\n 'nbhtbN De Scardino'\n\nNote that passing a formatters argument to ``censusname`` will exclude\nthe default surname formatter. It's easy enough to keep it, though:\n\n.. code:: python\n\n import censusname\n\n my_formatters = {\n 'surname': [censusname.formatters.recapitalize_surnames, custom_fuction] \n }", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fitnr/censusname", "keywords": "names development random", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "censusname", "package_url": "https://pypi.org/project/censusname/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/censusname/", "project_urls": { "Homepage": "https://github.com/fitnr/censusname" }, "release_url": "https://pypi.org/project/censusname/0.2.2/", "requires_dist": null, "requires_python": "", "summary": "Generate random names", "version": "0.2.2" }, "last_serial": 1767076, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "571d723c518174aa73c4e632eb94e8dd", "sha256": "7f84c698cd2a5434b95c6ebb0957c3f0f2efb671c0ebc63df8c64f08f33a9b98" }, "downloads": -1, "filename": "censusname-0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "571d723c518174aa73c4e632eb94e8dd", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 3672217, "upload_time": "2015-02-15T18:54:13", "url": "https://files.pythonhosted.org/packages/b9/f1/6b27b8f33874670cb70235d40510e250338b15e23aa5750396d5a4dd8583/censusname-0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "171b08357dbcbdb9b241b72fcd8bc488", "sha256": "c879c53cbd8a49b5a2a9ee0d0bb7ff3e9e9cc7e13e55551888249d3a4bbdd46b" }, "downloads": -1, "filename": "censusname-0.2.tar.gz", "has_sig": false, "md5_digest": "171b08357dbcbdb9b241b72fcd8bc488", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3610894, "upload_time": "2015-02-15T18:53:57", "url": "https://files.pythonhosted.org/packages/fe/0a/45284143b4e87798e90371ef09674fa5d8ff8779528e3740a99a0d239b76/censusname-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "289a927e4b51bdb37b8bbb15ffc2ae2b", "sha256": "7570f3a0815fa2ad7605537a4c05b019b7d573536d3914243e6f432d6648cdaf" }, "downloads": -1, "filename": "censusname-0.2.1-py2-none-any.whl", "has_sig": false, "md5_digest": "289a927e4b51bdb37b8bbb15ffc2ae2b", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 3678164, "upload_time": "2015-02-15T19:28:18", "url": "https://files.pythonhosted.org/packages/dd/46/ebe5559b33fdb97b017af84ded0a6778cc0e4416c9dbe88cc5c3a29ae57c/censusname-0.2.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9f9183f9a596940f216095421a4158f", "sha256": "9fc474074f866e35b026056ef4803f1222a7b7a15f33676d532c297b058459a2" }, "downloads": -1, "filename": "censusname-0.2.1.tar.gz", "has_sig": false, "md5_digest": "a9f9183f9a596940f216095421a4158f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3610917, "upload_time": "2015-02-15T19:28:09", "url": "https://files.pythonhosted.org/packages/2b/13/ddf3f424486cbb6da67935b967a2b067e586d41f44fbd2d34ab63b19fadc/censusname-0.2.1.tar.gz" } ], "0.2.1.post1": [ { "comment_text": "", "digests": { "md5": "0423b1cc6114dd060f6098e7e9e3b54c", "sha256": "532eaa4d61d37bffd6f94fcbacf5340657b7416bdb85e1e04565e658dc213470" }, "downloads": -1, "filename": "censusname-0.2.1.post1-py2-none-any.whl", "has_sig": false, "md5_digest": "0423b1cc6114dd060f6098e7e9e3b54c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 3678318, "upload_time": "2015-02-17T19:51:41", "url": "https://files.pythonhosted.org/packages/93/cc/d3d22c1ca8a881b9b28f7ec5441e536c46d24e6514d3cba9a0d04ef30ff5/censusname-0.2.1.post1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "60a55cefbfe075e7eba73f03b86aad56", "sha256": "af566c3c13763983993b47bac92adc8a97a816ea9175b506c866f051f5d2b0d4" }, "downloads": -1, "filename": "censusname-0.2.1.post1.tar.gz", "has_sig": false, "md5_digest": "60a55cefbfe075e7eba73f03b86aad56", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3610969, "upload_time": "2015-02-17T19:51:34", "url": "https://files.pythonhosted.org/packages/ba/c7/d8534125a18560ada665cc7042152a7a369600767795c8ed9cb27365eac5/censusname-0.2.1.post1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "fba4331d3e0437a1f30a64af4c192c3c", "sha256": "d1d1c27ec8840348a90411e186320181d80ba457e25d20cf9107b75607f8aa67" }, "downloads": -1, "filename": "censusname-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "fba4331d3e0437a1f30a64af4c192c3c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3684855, "upload_time": "2015-10-13T17:02:04", "url": "https://files.pythonhosted.org/packages/26/7b/f8121aa0d6700ffd9760b0b963a07ba69194418b25649d6f02828eac37e9/censusname-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "01e99735f2bb2d2edce9a3634bc69e9f", "sha256": "305f40af9e7738e3c3ddb85da16cdaccb09cd5a7f307242519eb6f3ff71f3673" }, "downloads": -1, "filename": "censusname-0.2.2.tar.gz", "has_sig": false, "md5_digest": "01e99735f2bb2d2edce9a3634bc69e9f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3616418, "upload_time": "2015-10-13T17:02:25", "url": "https://files.pythonhosted.org/packages/d6/25/7f37fb96480f2780ab069ff5f4c64ed322124a79d5b312a8cf2e94daec3a/censusname-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fba4331d3e0437a1f30a64af4c192c3c", "sha256": "d1d1c27ec8840348a90411e186320181d80ba457e25d20cf9107b75607f8aa67" }, "downloads": -1, "filename": "censusname-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "fba4331d3e0437a1f30a64af4c192c3c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3684855, "upload_time": "2015-10-13T17:02:04", "url": "https://files.pythonhosted.org/packages/26/7b/f8121aa0d6700ffd9760b0b963a07ba69194418b25649d6f02828eac37e9/censusname-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "01e99735f2bb2d2edce9a3634bc69e9f", "sha256": "305f40af9e7738e3c3ddb85da16cdaccb09cd5a7f307242519eb6f3ff71f3673" }, "downloads": -1, "filename": "censusname-0.2.2.tar.gz", "has_sig": false, "md5_digest": "01e99735f2bb2d2edce9a3634bc69e9f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3616418, "upload_time": "2015-10-13T17:02:25", "url": "https://files.pythonhosted.org/packages/d6/25/7f37fb96480f2780ab069ff5f4c64ed322124a79d5b312a8cf2e94daec3a/censusname-0.2.2.tar.gz" } ] }