{"id":24558160,"url":"https://github.com/rse/fasttext-lid","last_synced_at":"2025-04-19T09:59:02.850Z","repository":{"id":51299223,"uuid":"133142664","full_name":"rse/fasttext-lid","owner":"rse","description":"Language Identification with Facebook FastText for Node.js","archived":false,"fork":false,"pushed_at":"2023-09-21T07:31:41.000Z","size":18,"stargazers_count":11,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T21:55:46.356Z","etag":null,"topics":["fasttext","identification","language","lid","model","prediction"],"latest_commit_sha":null,"homepage":"http://npmjs.com/fasttext-lid","language":"JavaScript","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/rse.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,"governance":null}},"created_at":"2018-05-12T12:08:21.000Z","updated_at":"2024-07-10T11:20:23.000Z","dependencies_parsed_at":"2022-09-12T08:41:55.026Z","dependency_job_id":"61a3e61b-4f4a-4353-9748-782530c53cd5","html_url":"https://github.com/rse/fasttext-lid","commit_stats":{"total_commits":31,"total_committers":2,"mean_commits":15.5,"dds":"0.032258064516129004","last_synced_commit":"97bce0d032de68f61e562779bd3153838f10f195"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ffasttext-lid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ffasttext-lid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ffasttext-lid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ffasttext-lid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rse","download_url":"https://codeload.github.com/rse/fasttext-lid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249366331,"owners_count":21258347,"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":["fasttext","identification","language","lid","model","prediction"],"created_at":"2025-01-23T05:47:32.893Z","updated_at":"2025-04-19T09:59:02.833Z","avatar_url":"https://github.com/rse.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nFastText-LID\n============\n\nLanguage Identification with Facebook FastText\n\n\u003cp/\u003e\n\u003cimg src=\"https://nodei.co/npm/fasttext-lid.png?downloads=true\u0026stars=true\" alt=\"\"/\u003e\n\n\u003cp/\u003e\n\u003cimg src=\"https://david-dm.org/rse/fasttext-lid.png\" alt=\"\"/\u003e\n\nAbout\n-----\n\nThis is a small JavaScript library for use in [Node.js](https://nodejs.org/) environments,\nproviding the possibility to identify the language of a piece of text\nwith the help of the Wikipedia/Tatoeba/SETimes-derived\n[pre-trained LID-176 model](https://fasttext.cc/docs/en/language-identification.html)\nand the fast and efficient [Facebook FastText](https://fasttext.cc/) Machine-Learning-based\ntext classification engine. The classification result is a list of\nidentified languages (identified by their two-character ISO codes) and their\nclassification probability.\n\nNOTICE\n------\n\nThe LID-176 model is licensed under\n[CC-BY-SA](http://creativecommons.org/licenses/by-sa/3.0/) and not part\nof this module. It is 126 MB in size and detects 176 languages. It is automatically downloaded from\nits external origin on `npm install`. Applications using this Node.js\nmodule have to take the license of this external model into account.\nThe module [cld](https://github.com/dachev/node-cld) (Apache licensed, 160 languages)\nand the module [franc](http://wooorm.com/franc/) (MIT licensed, 188 or 400 languages)\nare decent alternatives.\n\nInstallation\n------------\n\n```shell\n$ npm install fasttext-lid\n```\n\nUsage\n-----\n\n```js\n(async () =\u003e {\n    const LID = require(\"fasttext-lid\")\n    const lid = new LID()\n\n    console.log(await lid.predict(\"FastText-LID provides a great language identification\"))\n    console.log(await lid.predict(\"FastText-LID bietet eine hervorragende Sprachidentifikation\"))\n    console.log(await lid.predict(\"FastText-LID fornisce un ottimo linguaggio di identificazione\"))\n    console.log(await lid.predict(\"FastText-LID fournit une excellente identification de la langue\"))\n    console.log(await lid.predict(\"FastText-LID proporciona una gran identificación de idioma\"))\n    console.log(await lid.predict(\"FastText-LID обеспечивает отличную идентификацию языка\"))\n    console.log(await lid.predict(\"FastText-LID提供了很好的語言識別\"))\n})()\n```\n\nOutput:\n\n```\n[ { lang: 'en', prob: 0.6313226222991943 } ]\n[ { lang: 'de', prob: 0.9137916564941406 } ]\n[ { lang: 'it', prob: 0.974501371383667 } ]\n[ { lang: 'fr', prob: 0.7358829975128174 } ]\n[ { lang: 'es', prob: 0.9211937189102173 } ]\n[ { lang: 'ru', prob: 0.9899846911430359 } ]\n[ { lang: 'zh', prob: 0.8515647649765015 } ]\n```\n\nApplication Programming Interface\n---------------------------------\n\n- `new LID({ model?: string }): LID`:\u003cbr/\u003e\n  Instantiate a new Language Identification object.\n  Optionally, you could pass it the path to a different FastText model.\n  The default is to use the LID-176 model which was downloaded on `npm install`.\n\n- `LID::predict(text: string, k?: number }): [ { lang: string, prob: number }* ]`:\u003cbr/\u003e\n  Predict the language for `text` and return the first `k` predictions (in decreasing probability order).\n  The default is `1` for `k`.\n\nLicense\n-------\n\nCopyright \u0026copy; 2018-2023 Dr. Ralf S. Engelschall (http://engelschall.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Ffasttext-lid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frse%2Ffasttext-lid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Ffasttext-lid/lists"}