lol-id-tools


Namelol-id-tools JSON
Version 1.7.0 PyPI version JSON
download
home_pagehttps://github.com/mrtolkien/lol_id_tools
SummaryAn id tool for League of Legends with fuzzy string matching, nicknames, multiple locales, automatic updates, and translation.
upload_time2020-11-22 03:41:26
maintainer
docs_urlNone
authorTolki
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Python package](https://github.com/mrtolkien/lol_id_tools/workflows/Python%20package/badge.svg)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)



# lol_id_tools
An id tool for League of Legends with fuzzy string matching, nicknames, multiple locales, automatic updates, 
and translation.

The package relies on [rapidfuzz](https://github.com/rhasspy/rapidfuzz) for string matching.

This documentation pertains to version `1.0.0` and forward.

# Installation

Get lit with `pip install lol-id-tools`

# Demo
![Demo](demo.gif)

# Usage
## Import
```
import lol_id_tools as lit
```
## Get id from name
When the name is typed properly, matching takes 0.0004ms.
```
lit.get_id('Miss Fortune')
> 21
timeit('lit.get_id("miss fortune")', setup="import lol_id_tools as lit", number=1000)
> 0.0004502000000030648
```

Fuzzy string matching takes about 2ms.
```
lit.get_id('misfortune')
> 21
timeit('lit.get_id("misfortune")', setup="import lol_id_tools as lit", number=1000)
> 2.0069257
```

If the source locale for the name is not loaded, you can force load it with
```
lit.get_id('미스 포츈', locale='ko_KR')
> 21
```

The minimum_score parameter can be used to alter behaviour. 
```
lit.get_id('misfo')
lit.NoMatchingNameFound: No object name close enough to the input string found.

lit.get_id('misfo', minimum_score = 50)
> 21
```

All types of object can be matched by default.
```
lit.get_id('Maw of Malmortius')
> 3156
```

## Get name from ID
On patch 10.10 no champion, item, or rune shares an ID. If they do in the future, the package will need to be
updated accordingly.

```
lit.get_name(11)
> 'Master Yi'
```

If a locale needed for output is not loaded, it will automatically add it to the package.
```
lit.get_name(11, 'fr_FR')
> 'Maître Yi'
```

## Get translation
Default output is 'en_US'
```
lit.get_translation('미스 포츈')
> 'Miss Fortune'
```

If you haven’t loaded the input locale yet, you can supply it as a parameter
```
lit.get_translation('ミス・フォーチュン', 'zh_CN', input_locale='ja_JP')
> '赏金猎人'
```

If get_translation() is called on an existing locale, it returns the "clean" object name
```
lit.get_translation('Misfo', minimum_score = 50)
> 'Miss Fortune'
```

## Tests

You can take a look at the [tests suit](https://github.com/mrtolkien/lol_id_tools/tree/master/lol_id_tools/_tests) 
for more code examples.

## Notes

Data is saved in `~/.config/lol_id_tools` for offline usage and faster startup after first use.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mrtolkien/lol_id_tools",
    "name": "lol-id-tools",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Tolki",
    "author_email": "gary.mialaret+pypi@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6e/de/8834f34f0d38faec4ef91c6f8878fbf8224164e523d2b5aec88485b384e3/lol_id_tools-1.7.0.tar.gz",
    "platform": "",
    "description": "![Python package](https://github.com/mrtolkien/lol_id_tools/workflows/Python%20package/badge.svg)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n\n\n# lol_id_tools\nAn id tool for League of Legends with fuzzy string matching, nicknames, multiple locales, automatic updates, \nand translation.\n\nThe package relies on [rapidfuzz](https://github.com/rhasspy/rapidfuzz) for string matching.\n\nThis documentation pertains to version `1.0.0` and forward.\n\n# Installation\n\nGet lit with `pip install lol-id-tools`\n\n# Demo\n![Demo](demo.gif)\n\n# Usage\n## Import\n```\nimport lol_id_tools as lit\n```\n## Get id from name\nWhen the name is typed properly, matching takes 0.0004ms.\n```\nlit.get_id('Miss Fortune')\n> 21\ntimeit('lit.get_id(\"miss fortune\")', setup=\"import lol_id_tools as lit\", number=1000)\n> 0.0004502000000030648\n```\n\nFuzzy string matching takes about 2ms.\n```\nlit.get_id('misfortune')\n> 21\ntimeit('lit.get_id(\"misfortune\")', setup=\"import lol_id_tools as lit\", number=1000)\n> 2.0069257\n```\n\nIf the source locale for the name is not loaded, you can force load it with\n```\nlit.get_id('\ubbf8\uc2a4 \ud3ec\uce08', locale='ko_KR')\n> 21\n```\n\nThe minimum_score parameter can be used to alter behaviour. \n```\nlit.get_id('misfo')\nlit.NoMatchingNameFound: No object name close enough to the input string found.\n\nlit.get_id('misfo', minimum_score = 50)\n> 21\n```\n\nAll types of object can be matched by default.\n```\nlit.get_id('Maw of Malmortius')\n> 3156\n```\n\n## Get name from ID\nOn patch 10.10 no champion, item, or rune shares an ID. If they do in the future, the package will need to be\nupdated accordingly.\n\n```\nlit.get_name(11)\n> 'Master Yi'\n```\n\nIf a locale needed for output is not loaded, it will automatically add it to the package.\n```\nlit.get_name(11, 'fr_FR')\n> 'Ma\u00eetre Yi'\n```\n\n## Get translation\nDefault output is 'en_US'\n```\nlit.get_translation('\ubbf8\uc2a4 \ud3ec\uce08')\n> 'Miss Fortune'\n```\n\nIf you haven\u2019t loaded the input locale yet, you can supply it as a parameter\n```\nlit.get_translation('\u30df\u30b9\u30fb\u30d5\u30a9\u30fc\u30c1\u30e5\u30f3', 'zh_CN', input_locale='ja_JP')\n> '\u8d4f\u91d1\u730e\u4eba'\n```\n\nIf get_translation() is called on an existing locale, it returns the \"clean\" object name\n```\nlit.get_translation('Misfo', minimum_score = 50)\n> 'Miss Fortune'\n```\n\n## Tests\n\nYou can take a look at the [tests suit](https://github.com/mrtolkien/lol_id_tools/tree/master/lol_id_tools/_tests) \nfor more code examples.\n\n## Notes\n\nData is saved in `~/.config/lol_id_tools` for offline usage and faster startup after first use.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An id tool for League of Legends with fuzzy string matching, nicknames, multiple locales, automatic updates, and translation.",
    "version": "1.7.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "5ee0258bb8c7cacf31a6379211fa2dc3",
                "sha256": "f34047d34c98b4cb678d978347b715d0b0580ad54a1da1af20674df383cdfa80"
            },
            "downloads": -1,
            "filename": "lol_id_tools-1.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5ee0258bb8c7cacf31a6379211fa2dc3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13480,
            "upload_time": "2020-11-22T03:41:26",
            "upload_time_iso_8601": "2020-11-22T03:41:26.520510Z",
            "url": "https://files.pythonhosted.org/packages/6e/de/8834f34f0d38faec4ef91c6f8878fbf8224164e523d2b5aec88485b384e3/lol_id_tools-1.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-11-22 03:41:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "mrtolkien",
    "error": "Could not fetch GitHub repository",
    "lcname": "lol-id-tools"
}
        
Elapsed time: 0.18355s