{"id":44470320,"url":"https://github.com/vipranarayan14/aksharas","last_synced_at":"2026-02-12T21:16:12.550Z","repository":{"id":65362918,"uuid":"522678888","full_name":"vipranarayan14/aksharas","owner":"vipranarayan14","description":"An utility for analysing akṣaras and varṇas in an Devanagari text.","archived":false,"fork":false,"pushed_at":"2023-03-22T08:38:41.000Z","size":617,"stargazers_count":3,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-21T23:30:02.703Z","etag":null,"topics":["character-counter","characters","devanagari","indic-languages","indic-scripts","sanskrit","sanskrit-language","syllabification","syllables"],"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/vipranarayan14.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2022-08-08T19:22:13.000Z","updated_at":"2025-09-25T12:57:07.000Z","dependencies_parsed_at":"2024-09-02T14:01:06.745Z","dependency_job_id":"bbd161a3-93ec-4979-85f4-94bb0142c63b","html_url":"https://github.com/vipranarayan14/aksharas","commit_stats":{"total_commits":51,"total_committers":1,"mean_commits":51.0,"dds":0.0,"last_synced_commit":"78981702d4c217d490ec59b17c722a6faa837a21"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/vipranarayan14/aksharas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vipranarayan14%2Faksharas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vipranarayan14%2Faksharas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vipranarayan14%2Faksharas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vipranarayan14%2Faksharas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vipranarayan14","download_url":"https://codeload.github.com/vipranarayan14/aksharas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vipranarayan14%2Faksharas/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29381343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T20:34:40.886Z","status":"ssl_error","status_checked_at":"2026-02-12T20:23:00.490Z","response_time":55,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["character-counter","characters","devanagari","indic-languages","indic-scripts","sanskrit","sanskrit-language","syllabification","syllables"],"created_at":"2026-02-12T21:16:11.832Z","updated_at":"2026-02-12T21:16:12.546Z","avatar_url":"https://github.com/vipranarayan14.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aksharas\n\n[![npm (scoped)](https://img.shields.io/npm/v/@vipran/aksharas)](https://www.npmjs.com/package/@vipran/aksharas) ![npm type definitions](https://img.shields.io/npm/types/@vipran/aksharas) ![NPM](https://img.shields.io/npm/l/@vipran/aksharas)\n\n**Aksharas** is an utility for analysing *akṣaras* and *varṇas* in a Devanagari text.\n\n\n## Installation\n\n```sh\nnpm i @vipran/aksharas\n```\n\n## Usage\n\n```js\nimport Aksharas from \"@vipran/aksharas\";\n\n// OR for CommonJS:\n// const Aksharas = require(\"@vipran/aksharas\").default;\n\nconst input = \"सर्वे भवन्तु सुखिनः।\"\n\nconst results = Aksharas.analyse(input);\n\nconst aksharas = results.aksharas.map(akshara =\u003e akshara.value);\n\nconsole.log(aksharas); // \"स\", \"र्वे\", \"भ\", \"व\", \"न्तु\", \"सु\", \"खि\", \"नः\"\n```\n\n## API\n\n### `Aksharas.analyse()`\n\nAccepts a `string` input and returns a [`Results`](#results) object.\n\n```ts\nconst input: string = 'नमः';\nconst results: Results = Aksharas.analyse(input);\n```\n\n### `Aksharas.TokenType`\n\nIt is an enum with the following values:\n\n- `TokenType.Akshara`\n- `TokenType.Symbol`\n- `TokenType.Whitespace`\n- `TokenType.Invalid`\n- `TokenType.Unrecognised`\n\nThese can be used to filter the tokens in the [`Results`](#results) object. Example:\n\n```js\nimport Aksharas from \"@vipran/aksharas\";\n// OR import Aksharas, { TokenType } ...\n\nconst input = \"हे! हरेऽत्र नागच्छ।\";\nconst results = Aksharas.analyse(input);\nconst symbols = results.all\n  .filter((token) =\u003e token.type === Aksharas.TokenType.Symbol)\n  .map((token) =\u003e token.value);\n\nconsole.log(symbols); // \"ऽ\", \"।\"\n```\n\n### `Aksharas.VarnaType`\n\nIt is an enum with the following values:\n\n- `VarnaType.Svara`\n- `VarnaType.Vyanjana`\n\nThese can be used to filter the varnas in [`Results.varnas`](#results). Example:\n\n```js\nimport Aksharas from \"@vipran/aksharas\";\n// OR import Aksharas, { VarnaType } ...\n\nconst input = \"गुरुः\";\nconst results = Aksharas.analyse(input);\n\nconst svaras = results.varnas\n  .filter((varna) =\u003e varna.type === Aksharas.VarnaType.Svara)\n  .map((varna) =\u003e varna.value);\n\nconsole.log(svaras); // \"उ\", \"उः\"\n```\n\n### `Results`\n\nThe `Results` object contains the following properties:\n\n- **all** \n    - type: `Token[]`\n    - An array of [`Token`](#token) objects containing all the tokens analysed from `input` string. It includes Devanagari *akṣaras*, Devanagari symbols (१, २, ।, ॥, etc.) and non-devangari characters (i.e. characters in other scripts, special characters, whitespace characters, etc.) \n- **aksharas** \n    - type: `Token[]`\n    - Devanagari syllables like रा, सी, etc. Here, *halanta* consonants such as क्, च्, य्, etc. are also considered as `aksharas` when they are at the end of a word.\n- **varnas** \n    - type: `Varna[]`\n    - Devanagari consonants and vowels in the `input`. *(Only in v0.4.0 or above.)*\n- **symbols** \n    - type: `Token[]`\n    - Devanagari symbols such as १, २, ।, ॥, etc. \n- **whitespaces** \n    - type: `Token[]`\n    - All whitespace characters: `\\s`, `\\t`, `\\n`, etc.\n- **invalid** \n    - type: `Token[]`\n    - All Devanagari characters whose occurance in the `input` string do not conform to the definition of an *akṣara*. For example, a *virāma* or a vowel mark which is not preceded by a consonant is invalid. (\"अ्\", \"गोु\", etc.) \n- **unrecognised** \n    - type: `Token[]`\n    - Non-devangari characters (i.e. characters in other scripts and special characters such as @, #, etc.)\n- **chars** \n    - type: `string[]`\n    - All Unicode characters in the `input` string. Same as `String.prototype.split()`.\n\n### `Token`\n\nMany of the properties in the `Results` object consists of an array of `Token`-s. A `Token` object has the following properties:\n\n- **type**\n    - type: `TokenType`\n    - Type of the token. One of the values of [`Aksharas.TokenType`](#aksharastokentype).\n- **value**\n    - type: `string`\n    - Conatins an analysed part of the `input` string.\n- **from**\n    - type: `number`\n    - From index - representing the start position of the token in the `input` string.\n- **to**\n    - type: `number`\n    - To index - representing the end position of the token in the `input` string.\n- **attributes**\n    - type: `Record\u003cstring, any\u003e`\n    - An optional key-value object which may contain other attributes of the token. It is currently used only in the `Akshara` tokens for storing the `varnas` in that akshara.\n\n### `Varna`\n\n`Results.varnas` consists of an array of `Varna` objects. A `Varna` object has the following properties:\n\n- **type**\n    - type: `VarnaType`\n    - Type of the token. One of the values of [`Aksharas.VarnaType`](#aksharasvarnatype).\n- **value**\n    - type: `string`\n    - Conatins an analysed part of the `input` string.\n\n\n## License\n\nMIT © [Prasanna Venkatesh T S](https://github.com/vipranarayan14)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvipranarayan14%2Faksharas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvipranarayan14%2Faksharas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvipranarayan14%2Faksharas/lists"}