countrynames


Namecountrynames JSON
Version 1.15.3 PyPI version JSON
download
home_pagehttp://github.com/occrp/countrynames
SummaryA library to map country names to ISO codes.
upload_time2023-10-30 11:54:28
maintainer
docs_urlNone
authorFriedrich Lindenberg
requires_python
licenseMIT
keywords names countries iso country
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # countrynames

[![build](https://github.com/alephdata/countrynames/actions/workflows/build.yml/badge.svg)](https://github.com/alephdata/countrynames/actions/workflows/build.yml)

This library helps with the mapping of country names to their respective
two or three letter codes. The idea is
to incorporate common names for countries, and even some limited misspellings,
as they occur in source data.

There is also support for fuzzy matching, which uses a heuristic based on levenshtein distance.

## Usage

```python
import countrynames

assert 'DE' == countrynames.to_code('Germany')
assert 'DE' == countrynames.to_code('Bundesrepublik Deutschland')
assert 'DE' == countrynames.to_code('Bundesrepublik Deutschlan', fuzzy=True)
assert 'DE' == countrynames.to_code('DE')
assert 'DEU' == countrynames.to_code_3('Germany')
```

## Non-standard country codes

* ``XK`` or ``XKX`` - Kosovo
* ``EU`` or ``EUU`` - European Union

For some dissolved countries (e.g. `SUHH` for Soviet Union) and sub-regions
(e.g. `GB-SCT` for Scotland) special codes are defined and returned from both
`to_code` and `to_code_3`.

## License

The MIT License (MIT)

Copyright (c) 2016 Friedrich Lindenberg

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/occrp/countrynames",
    "name": "countrynames",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "names countries iso country",
    "author": "Friedrich Lindenberg",
    "author_email": "friedrich@pudo.org",
    "download_url": "https://files.pythonhosted.org/packages/e7/26/c30d1da7146fe83213cdc9604182a5f7daae3c601c4b703a27a37a9c5821/countrynames-1.15.3.tar.gz",
    "platform": null,
    "description": "# countrynames\n\n[![build](https://github.com/alephdata/countrynames/actions/workflows/build.yml/badge.svg)](https://github.com/alephdata/countrynames/actions/workflows/build.yml)\n\nThis library helps with the mapping of country names to their respective\ntwo or three letter codes. The idea is\nto incorporate common names for countries, and even some limited misspellings,\nas they occur in source data.\n\nThere is also support for fuzzy matching, which uses a heuristic based on levenshtein distance.\n\n## Usage\n\n```python\nimport countrynames\n\nassert 'DE' == countrynames.to_code('Germany')\nassert 'DE' == countrynames.to_code('Bundesrepublik Deutschland')\nassert 'DE' == countrynames.to_code('Bundesrepublik Deutschlan', fuzzy=True)\nassert 'DE' == countrynames.to_code('DE')\nassert 'DEU' == countrynames.to_code_3('Germany')\n```\n\n## Non-standard country codes\n\n* ``XK`` or ``XKX`` - Kosovo\n* ``EU`` or ``EUU`` - European Union\n\nFor some dissolved countries (e.g. `SUHH` for Soviet Union) and sub-regions\n(e.g. `GB-SCT` for Scotland) special codes are defined and returned from both\n`to_code` and `to_code_3`.\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 Friedrich Lindenberg\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A library to map country names to ISO codes.",
    "version": "1.15.3",
    "project_urls": {
        "Homepage": "http://github.com/occrp/countrynames"
    },
    "split_keywords": [
        "names",
        "countries",
        "iso",
        "country"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3045fd238e5436049838b6625b38040c84ab4c0ce9701b03a12aa0731103a2ce",
                "md5": "0795a7852251b95f936ff8c32201f8ea",
                "sha256": "a510d25facf5b0672ed0b4a678af71a868fd7fb54fa49609887c884df682f827"
            },
            "downloads": -1,
            "filename": "countrynames-1.15.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0795a7852251b95f936ff8c32201f8ea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 471018,
            "upload_time": "2023-10-30T11:54:25",
            "upload_time_iso_8601": "2023-10-30T11:54:25.831649Z",
            "url": "https://files.pythonhosted.org/packages/30/45/fd238e5436049838b6625b38040c84ab4c0ce9701b03a12aa0731103a2ce/countrynames-1.15.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e726c30d1da7146fe83213cdc9604182a5f7daae3c601c4b703a27a37a9c5821",
                "md5": "a5abc06890396027df7ea52ae56b6946",
                "sha256": "b078056c182c2b0d7a0526c9dd6e229ba753cd3707aa0c77877dff926d3491d5"
            },
            "downloads": -1,
            "filename": "countrynames-1.15.3.tar.gz",
            "has_sig": false,
            "md5_digest": "a5abc06890396027df7ea52ae56b6946",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 466076,
            "upload_time": "2023-10-30T11:54:28",
            "upload_time_iso_8601": "2023-10-30T11:54:28.575243Z",
            "url": "https://files.pythonhosted.org/packages/e7/26/c30d1da7146fe83213cdc9604182a5f7daae3c601c4b703a27a37a9c5821/countrynames-1.15.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-30 11:54:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "occrp",
    "github_project": "countrynames",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "countrynames"
}
        
Elapsed time: 0.13929s