countrynames


Namecountrynames JSON
Version 1.16.2 PyPI version JSON
download
home_pagehttp://github.com/occrp/countrynames
SummaryA library to map country names to ISO codes.
upload_time2024-10-14 06:52:32
maintainerNone
docs_urlNone
authorFriedrich Lindenberg
requires_pythonNone
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": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "names countries iso country",
    "author": "Friedrich Lindenberg",
    "author_email": "friedrich@pudo.org",
    "download_url": "https://files.pythonhosted.org/packages/a8/25/190a6237e21ba4ebc56191d8259f4213bcb7a7e1be67c061da9da14a1943/countrynames-1.16.2.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.16.2",
    "project_urls": {
        "Homepage": "http://github.com/occrp/countrynames"
    },
    "split_keywords": [
        "names",
        "countries",
        "iso",
        "country"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7b2bc97a48b9c1b7b4ddc30b5ebc53e058f4b25f7b0f8a5f93c0177b0883b9a3",
                "md5": "fd91553ae1052fdd436ff35ab6ffda8f",
                "sha256": "6bb042919af6e2dca543fee0108f09b5c457f13195a86d4ca572fddc6c646156"
            },
            "downloads": -1,
            "filename": "countrynames-1.16.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fd91553ae1052fdd436ff35ab6ffda8f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 473063,
            "upload_time": "2024-10-14T06:52:30",
            "upload_time_iso_8601": "2024-10-14T06:52:30.960573Z",
            "url": "https://files.pythonhosted.org/packages/7b/2b/c97a48b9c1b7b4ddc30b5ebc53e058f4b25f7b0f8a5f93c0177b0883b9a3/countrynames-1.16.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a825190a6237e21ba4ebc56191d8259f4213bcb7a7e1be67c061da9da14a1943",
                "md5": "2844a9f7791652706a12e8f25c51ec1f",
                "sha256": "c5d21218734add3700d71a732d5875305d4ff055c1f3a3522432eb712c017c5c"
            },
            "downloads": -1,
            "filename": "countrynames-1.16.2.tar.gz",
            "has_sig": false,
            "md5_digest": "2844a9f7791652706a12e8f25c51ec1f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 468139,
            "upload_time": "2024-10-14T06:52:32",
            "upload_time_iso_8601": "2024-10-14T06:52:32.210348Z",
            "url": "https://files.pythonhosted.org/packages/a8/25/190a6237e21ba4ebc56191d8259f4213bcb7a7e1be67c061da9da14a1943/countrynames-1.16.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-14 06:52:32",
    "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.38469s