{"id":13937100,"url":"https://github.com/derek73/python-nameparser","last_synced_at":"2025-10-21T20:49:54.735Z","repository":{"id":15617056,"uuid":"18353524","full_name":"derek73/python-nameparser","owner":"derek73","description":"A simple Python module for parsing human names into their individual components ","archived":false,"fork":false,"pushed_at":"2024-05-28T06:40:23.000Z","size":797,"stargazers_count":675,"open_issues_count":38,"forks_count":105,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-07-05T01:07:07.695Z","etag":null,"topics":["python","python-module","text-parser","text-processing"],"latest_commit_sha":null,"homepage":"http://nameparser.readthedocs.org/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/derek73.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-02T03:31:21.000Z","updated_at":"2025-07-01T16:08:59.000Z","dependencies_parsed_at":"2024-06-18T13:03:58.654Z","dependency_job_id":"8f23e325-f975-4198-bd5e-f4b7d165b6d0","html_url":"https://github.com/derek73/python-nameparser","commit_stats":{"total_commits":368,"total_committers":23,"mean_commits":16.0,"dds":0.1440217391304348,"last_synced_commit":"c2d07184489ae733ff7dcb6c3e395cf682e7bb5b"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"purl":"pkg:github/derek73/python-nameparser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derek73%2Fpython-nameparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derek73%2Fpython-nameparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derek73%2Fpython-nameparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derek73%2Fpython-nameparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derek73","download_url":"https://codeload.github.com/derek73/python-nameparser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derek73%2Fpython-nameparser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266041680,"owners_count":23867944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","python-module","text-parser","text-processing"],"created_at":"2024-08-07T23:03:17.695Z","updated_at":"2025-10-21T20:49:54.648Z","avatar_url":"https://github.com/derek73.png","language":"Python","readme":"Name Parser\n===========\n\n|Build Status| |PyPI| |PyPI version| |Documentation|\n\nA simple Python (3.2+ \u0026 2.6+) module for parsing human names into their\nindividual components. \n\n* hn.title\n* hn.first\n* hn.middle\n* hn.last\n* hn.suffix\n* hn.nickname\n* hn.surnames *(middle + last)*\n* hn.initials *(first initial of each name part)*\n\nSupported Name Structures\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe supported name structure is generally \"Title First Middle Last Suffix\", where all pieces \nare optional. Comma-separated format like \"Last, First\" is also supported.\n\n1. Title Firstname \"Nickname\" Middle Middle Lastname Suffix\n2. Lastname [Suffix], Title Firstname (Nickname) Middle Middle[,] Suffix [, Suffix]\n3. Title Firstname M Lastname [Suffix], Suffix [Suffix] [, Suffix]\n\nInstantiating the `HumanName` class with a string splits on commas and then spaces, \nclassifying name parts based on placement in the string and matches against known name \npieces like titles and suffixes. \n\nIt correctly handles some common conjunctions and special prefixes to last names\nlike \"del\". Titles and conjunctions can be chained together to handle complex\ntitles like \"Asst Secretary of State\". It can also try to correct capitalization\nof names that are all upper- or lowercase names.\n\nIt attempts the best guess that can be made with a simple, rule-based approach. \nIts main use case is English and it is not likely to be useful for languages \nthat do not conform to the supported name structure. It's not perfect, but it \ngets you pretty far.\n\nInstallation\n------------\n\n::\n\n  pip install nameparser\n\nIf you want to try out the latest code from GitHub you can\ninstall with pip using the command below.\n\n``pip install -e git+git://github.com/derek73/python-nameparser.git#egg=nameparser``\n\nIf you need to handle lists of names, check out\n`namesparser \u003chttps://github.com/gwu-libraries/namesparser\u003e`_, a\ncompliment to this module that handles multiple names in a string.\n\n\nQuick Start Example\n-------------------\n\n::\n\n    \u003e\u003e\u003e from nameparser import HumanName\n    \u003e\u003e\u003e name = HumanName(\"Dr. Juan Q. Xavier de la Vega III (Doc Vega)\")\n    \u003e\u003e\u003e name \n    \u003cHumanName : [\n    \ttitle: 'Dr.' \n    \tfirst: 'Juan' \n    \tmiddle: 'Q. Xavier' \n    \tlast: 'de la Vega' \n    \tsuffix: 'III'\n    \tnickname: 'Doc Vega'\n    ]\u003e\n    \u003e\u003e\u003e name.last\n    'de la Vega'\n    \u003e\u003e\u003e name.as_dict()\n    {'last': 'de la Vega', 'suffix': 'III', 'title': 'Dr.', 'middle': 'Q. Xavier', 'nickname': 'Doc Vega', 'first': 'Juan'}\n    \u003e\u003e\u003e str(name)\n    'Dr. Juan Q. Xavier de la Vega III (Doc Vega)'\n    \u003e\u003e\u003e name.string_format = \"{first} {last}\"\n    \u003e\u003e\u003e str(name)\n    'Juan de la Vega'\n\n\nThe parser does not attempt to correct mistakes in the input. It mostly just splits on white\nspace and puts things in buckets based on their position in the string. This also means\nthe difference between 'title' and 'suffix' is positional, not semantic. \"Dr\" is a title\nwhen it comes before the name and a suffix when it comes after. (\"Pre-nominal\"\nand \"post-nominal\" would probably be better names.)\n\n::\n\n    \u003e\u003e\u003e name = HumanName(\"1 \u0026 2, 3 4 5, Mr.\")\n    \u003e\u003e\u003e name \n    \u003cHumanName : [\n    \ttitle: '' \n    \tfirst: '3' \n    \tmiddle: '4 5' \n    \tlast: '1 \u0026 2' \n    \tsuffix: 'Mr.'\n    \tnickname: ''\n    ]\u003e\n\nCustomization\n-------------\n\nYour project may need some adjustment for your dataset. You can\ndo this in your own pre- or post-processing, by `customizing the configured pre-defined \nsets`_ of titles, prefixes, etc., or by subclassing the `HumanName` class. See the \n`full documentation`_ for more information.\n\n\n`Full documentation`_\n~~~~~~~~~~~~~~~~~~~~~\n\n.. _customizing the configured pre-defined sets: http://nameparser.readthedocs.org/en/latest/customize.html\n.. _Full documentation: http://nameparser.readthedocs.org/en/latest/\n\n\nContributing\n------------\n\nIf you come across name piece that you think should be in the default config, you're\nprobably right. `Start a New Issue`_ and we can get them added. \n\nPlease let me know if there are ways this library could be structured to make\nit easier for you to use in your projects. Read CONTRIBUTING.md_ for more info\non running the tests and contributing to the project.\n\n**GitHub Project**\n\nhttps://github.com/derek73/python-nameparser\n\n.. _CONTRIBUTING.md: https://github.com/derek73/python-nameparser/tree/master/CONTRIBUTING.md\n.. _Start a New Issue: https://github.com/derek73/python-nameparser/issues\n.. _click here to propose changes to the titles: https://github.com/derek73/python-nameparser/edit/master/nameparser/config/titles.py\n\n.. |Build Status| image:: https://github.com/derek73/python-nameparser/actions/workflows/python-package.yml/badge.svg\n   :target: https://github.com/derek73/python-nameparser/actions/workflows/python-package.yml\n.. |PyPI| image:: https://img.shields.io/pypi/v/nameparser.svg\n   :target: https://pypi.org/project/nameparser/\n.. |Documentation| image:: https://readthedocs.org/projects/nameparser/badge/?version=latest\n   :target: http://nameparser.readthedocs.io/en/latest/?badge=latest\n.. |PyPI version| image:: https://img.shields.io/pypi/pyversions/nameparser.svg\n   :target: https://pypi.org/project/nameparser/\n","funding_links":[],"categories":["Text Processing","资源列表","文本处理","Python","Text Processing [🔝](#readme)","Awesome Python","Open-Source Software"],"sub_categories":["文本处理","Text Processing","Data Cleaning and Parsing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderek73%2Fpython-nameparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderek73%2Fpython-nameparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderek73%2Fpython-nameparser/lists"}