{"id":21275354,"url":"https://github.com/ffreemt/fast-langid","last_synced_at":"2025-07-11T07:30:53.241Z","repository":{"id":57428633,"uuid":"369221416","full_name":"ffreemt/fast-langid","owner":"ffreemt","description":"Detect language of a given text, fast","archived":false,"fork":false,"pushed_at":"2024-07-04T09:00:54.000Z","size":880,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-09T08:57:23.349Z","etag":null,"topics":["detect","language","nlp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ffreemt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-20T13:40:44.000Z","updated_at":"2024-07-10T12:41:37.000Z","dependencies_parsed_at":"2023-01-30T04:01:06.414Z","dependency_job_id":null,"html_url":"https://github.com/ffreemt/fast-langid","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffreemt%2Ffast-langid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffreemt%2Ffast-langid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffreemt%2Ffast-langid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffreemt%2Ffast-langid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ffreemt","download_url":"https://codeload.github.com/ffreemt/fast-langid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225704684,"owners_count":17511143,"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":["detect","language","nlp"],"created_at":"2024-11-21T09:30:00.797Z","updated_at":"2024-11-21T09:30:01.494Z","avatar_url":"https://github.com/ffreemt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastlid\n\u003c!--- repo_name  pack_name  mod_name func_name ---\u003e\n[![tests](https://github.com/ffreemt/fast-langid/actions/workflows/routine-tests.yml/badge.svg)][![python](https://img.shields.io/static/v1?label=python+\u0026message=3.8%2B\u0026color=blue)](https://img.shields.io/static/v1?label=python+\u0026message=3.8%2B\u0026color=blue)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)[![PyPI version](https://badge.fury.io/py/fastlid.svg)](https://badge.fury.io/py/fastlid)\n\nLanguage identification based on fasttext (lid.176.ftz https://fasttext.cc/docs/en/language-identification.html).\n\nPython3.8, 3.9 only -- there seem to be some problems with python\n\nThe `lid.176.ftz` file is licensed under  Creative Commons Attribution-Share-Alike License 3.0 and is not part of this module. It is automatically downloaded from its external origin on the first run of this module.\n\nThis module attempts to immitate the follow two features of `langid`\n*   langid.classify: fastlid\n*   langid.set_languages(langs=[...]): fastlid.set_languages = [...]\n    *   import fastlid\n    *   fastlid.set_languages = ['nl','fr'])\n*   TODO: Commandline interface\n\n## Install it\n\n```bash\npip install fastlid\n```\nor install from `git`\n```bash\npip install git+https://github.com/ffreemt/fast-langid.git\n\n# also works pip install git+https://github.com/ffreemt/fast-langid\n```\nor clone the git repo and install from source.\n\n## Use it\n```python\nfrom fastlid import fastlid, supported_langs\n\n# support 176 languages\nprint(supported_langs, len(supported_langs))\n# ['af', 'als', 'am', 'an', 'ar', 'arz', 'as', 'ast', 'av', 'az'] 176\n\nfastlid(\"test this\")\n# ('en', 0.765)\n\nfastlid(\"test this 测试一下\", k=2)\n# (['zh', 'en'], [0.663, 0.124])\n\nfastlid.set_languages = ['fr', 'zh']\nfastlid(\"test this 测试吧\")\n# ('zh', 0.01)\n\nfastlid.set_languages = None\nfastlid(\"test this 测试吧\")\n('en', 0.686)\n\nfastlid.set_languages = ['fr', 'zh', 'en']\nfastlid(\"test this 测试吧\", k=3)\n(['en', 'zh', 'fr'], [0.686, 0.01, 0.006])\n```\n\nN.B. `hanzidentifier` can be used to identify simplified Chinese or/and traditional Chinese should you need to do so.\n\n## For Developers\nInstall `poetry` and `yarn` the way you like it.\n```bash\npoetry install  # install python packages\nyarn install --dev  # install necesary node packages\n\n# ...code...\nyarn test\nyarn final\n\n# ...optionally submit pr...\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffreemt%2Ffast-langid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fffreemt%2Ffast-langid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffreemt%2Ffast-langid/lists"}