Logo Lanfrica

Wossnap/amharic-transliteration

Domain:

natural language processing

Record type:

software
Creator:
Wos
Host:
# wossnap/amharic-transliteration A Laravel package for transliterating Amharic (Ethiopic) text to Latin and handling phonetically equivalent character variants. Amharic has several characters that share the same sound — for example `አ`, `ዓ`, `ኣ`, and `ዐ` are all pronounced the same way. This package maps every character to its Latin phonetic equivalent and provides tools to work with those variants in search, speech recognition, and admin interfaces. --- ## Requirements - PHP 8.1+ - Laravel 10, 11, or 12 --- ## Installation ```bash composer require wossnap/amharic-transliteration ``` Laravel auto-discovers the service provider. No manual registration needed. --- ## Quick start ```php use Wossnap\AmharicTransliteration\Facades\AmharicTransliteration; AmharicTransliteration::transliterate('ሰላም'); // → "selam" AmharicTransliteration::getAmharicVariants('አምሮ'); // → ["አምሮ", "ኣምሮ", "ዐምሮ", "ዓምሮ"] ``` You can also inject the service directly: ```php use Wossnap\AmharicTransliteration\AmharicTransliterationService; class WordController extends Controller { public function __construct( private AmharicTransliterationService $transliterator ) {} public function store(Request $request) { $transliterations = $this->transliterator->getSuggestedTransliterations( $request->input('word') ); } } ``` --- ## API reference ### Core transliteration #### `transliterate(string $text): string` Transliterate a full Amharic string to its Latin phonetic equivalent. Non-Amharic characters (spaces, numbers, punctuation) pass through unchanged. ```php AmharicTransliteration::transliterate('ሰላም'); // "selam" AmharicTransliteration::transliterate('ደህና ሁን'); // "dehna hun" AmharicTransliteration::transliterate('hello ሰላም'); // "hello selam" ``` --- #### `transliterateChar(string $char): ?string` Transliterate a single character. Returns `null` if the character has no mapping. ```php AmharicTransliteration::transliterateChar('ሰ'); // "se" AmharicTranslite …

Languages

Licenses