A JavaScript library for transliterating Chechen text written in Cyrillic script to Latin script using a predefined mapping.
- Introduction
- Features
- Installation
- Usage
- Special Handling
- Examples
- Configuration
- Development
- License
@ce/transliteration is a library that provides an easy way to transliterate Chechen text from Cyrillic to Latin script based on a predefined mapping. The transliteration is designed to accurately represent Chechen phonetics in Latin script.
Check out the live demo to see the transliteration in action.
- Transliterates Chechen text from Cyrillic to Latin script.
- Special handling for specific characters, including contextual rules.
- Configurable transliteration mapping.
- Provides a comprehensive set of tools for Chechen language processing.
To install @ce/transliteration, use npm or yarn:
npx jsr add @ce/transliterationor
yarn dlx jsr add @ce/transliterationor
deno add @ce/transliterationHere's how to use the transliteration library in your JavaScript or TypeScript project:
import { apply, translitMap } from "@ce/transliteration";
const result = apply('дӏахьäдира');
console.log(result); // Output: 'djaẋädira'
console.log(translitMap);The library includes some specific handling for the character 'н':
- End of Word: If 'н' appears at the end of a word, it is generally transliterated as 'ŋ'.
- Blacklist: If the word is in a predefined blacklist, 'н' is transliterated as 'n'.
- Uncertain List: If the word is in the "unsureList", 'н' is transliterated as 'ŋ[REPLACE]' to indicate that manual review is needed.
Transliterate a Chechen text:
import { apply } from "@ce/transliteration";
const text = 'дӏахьäдира';
const transliteratedText = apply(text);
console.log(transliteratedText); // Output: 'djaẋädira'Transliterate a Chechen text with special handling:
import { apply } from "@ce/transliteration";
const text = 'шун';
const transliteratedText = apply(text);
console.log(transliteratedText); // Output: 'şuŋ[REPLACE]'The transliteration rules are defined in a mapping object (translitMap). You can view or modify the transliteration mapping according to your needs. For more information, check the translit.ts file in the repository.
.
├── .github
│ └── workflows
│ └── publish.yml
├── __tests__
│ └── translit.test.ts
├── .gitignore
├── jest.config.js
├── jsr.json
└── translit.ts.github/workflows/publish.yml: CI/CD configuration for building and publishing the package.__tests__/translit.test.ts: Test cases for the transliteration logic.translit.ts: Core library file containing the transliteration logic and mapping.jest.config.js: Jest configuration for running tests.jsr.json: Contains metadata for the JavaScript Registry.
This project uses Jest for testing. To run the test suite with coverage reports, use the following command:
jest --coverageThis project is licensed under the MIT License.