{"id":15504469,"url":"https://github.com/kwonoj/cld3-asm","last_synced_at":"2025-05-07T21:43:57.694Z","repository":{"id":66079748,"uuid":"101367593","full_name":"kwonoj/cld3-asm","owner":"kwonoj","description":"WebAssembly based Javascript bindings for google Compact Language Detector v3","archived":false,"fork":false,"pushed_at":"2023-12-31T20:50:24.000Z","size":3637,"stargazers_count":57,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-19T18:30:08.700Z","etag":null,"topics":["cld","cld3","compact-language-detector","detection","language","language-detector","typescript","wasm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kwonoj.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-08-25T04:58:34.000Z","updated_at":"2024-09-30T15:00:17.000Z","dependencies_parsed_at":"2024-04-17T00:43:08.356Z","dependency_job_id":"17d3aefd-cfac-4fc0-b9b9-b1841dcfd306","html_url":"https://github.com/kwonoj/cld3-asm","commit_stats":{"total_commits":255,"total_committers":3,"mean_commits":85.0,"dds":"0.21176470588235297","last_synced_commit":"ba3037c6797dabb578186ec208aa31b5f321c48b"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Fcld3-asm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Fcld3-asm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Fcld3-asm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Fcld3-asm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kwonoj","download_url":"https://codeload.github.com/kwonoj/cld3-asm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234444581,"owners_count":18833657,"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":["cld","cld3","compact-language-detector","detection","language","language-detector","typescript","wasm","webassembly"],"created_at":"2024-10-02T09:18:14.175Z","updated_at":"2025-01-17T23:51:36.527Z","avatar_url":"https://github.com/kwonoj.png","language":"TypeScript","funding_links":[],"categories":["Projects"],"sub_categories":["Others"],"readme":"[![npm](https://img.shields.io/npm/v/cld3-asm.svg)](https://www.npmjs.com/package/cld3-asm)\n[![node](https://img.shields.io/badge/node-=\u003e8.0-blue.svg?style=flat)](https://www.npmjs.com/package/cld3-asm)\n\n# cld3-asm\n\n`cld3-asm` is isomorphic javascript binding to google's [compact language detector v3](https://github.com/google/cld3) based on WebAssembly cld3 binary. This module aims to provide thin, lightweight interface to cld3 without requiring native modules.\n\n# Install\n\n```sh\nnpm install cld3-asm\n```\n\n# Usage\n\n## Loading module asynchronously\n\n`cld3-asm` relies on wasm binary of cld3, which need to be initialized first.\n\n```js\nimport { loadModule } from 'cld3-asm';\n\nconst cldFactory = await loadModule();\n```\n\n`loadModule` loads wasm binary, initialize it, and returns factory function to create instance of cld3 [language identifier.](https://github.com/kwonoj/cld3-asm/blob/1a86bb67abcebc2cd0e90a83149292eb044e4122/src/cldAsmModule.ts#L70-L97)\n\n```js\nloadModule({ timeout?: number }): Promise\u003cCldFactory\u003e\n```\n\nIt allows to specify timeout to wait until wasm binary compliation \u0026 load.\n\n## Creating language identifier\n\n```js\ncreate(minBytes?: number, maxBytes?: number): LanguageIdentifier\n```\n\n`LanguageIdentifier` exposes minimal interfaces to cld3's `NNetLanguageIdentifier`.\n\n- `findLanguage(text: string): Readonly\u003cLanguageResult\u003e` : Finds the most likely language for the given text.\n- `findMostFrequentLanguages(text: string, numLangs: number): Array\u003cReadonly\u003cLanguageResult\u003e\u003e` : Splits the input text into spans based on the script, predicts a language for each span, and returns a vector storing the top num_langs most frequent languages\n- `dispose(): void` : Destroy current instance of language identifier. It is important to note created instance will not be destroyed automatically.\n\nThere are simple [examples](https://github.com/kwonoj/cld3-asm/tree/master/examples) for each environments. In each example directory do `npm install \u0026\u0026 npm start`.\n\n# Building / Testing\n\nFew npm scripts are supported for build / test code.\n\n- `build`: Transpiles code to ES5 commonjs to `dist`.\n- `test`: Run `cld` / `cld3-asm` test both. Does not require `build` before execute test.\n- `test:cld`: Run integration test for actual cld3 wasm binary, using [cld's test case](https://github.com/google/cld3/blob/2afbfc6f8b82cb7a5557c81862509e06f4f23ac4/src/nnet_lang_id_test.cc).\n- `test:cld3-asm`: Run unit test against `cld3-asm` interface\n- `lint`: Run lint over all codebases\n- `lint:staged`: Run lint only for staged changes. This'll be executed automatically with precommit hook.\n- `commit`: Commit wizard to write commit message\n\n# License\n\n- cld3: [original license](https://github.com/google/cld3/blob/master/LICENSE)\n- cld3-asm: [MIT](https://github.com/kwonoj/cld3-asm/blob/master/LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwonoj%2Fcld3-asm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkwonoj%2Fcld3-asm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwonoj%2Fcld3-asm/lists"}