Logo Lanfrica

yafetphilipos/amharic-transliteration

Domaine:

natural language processing

Type de record:

software
Créateur:
yaf
Hôte:
A Laravel package for dual-way Amharic to English transliteration. Effortlessly convert Amharic script to English phonetics and back. # Amharic Transliteration Laravel Package A Laravel package for dual-way Amharic to English transliteration. Effortlessly convert Amharic script to English phonetics and back. ## Features - **Amharic to English**: Converts Amharic characters to English with smart suffix handling (removes 'i' at word endings). - **English to Amharic**: Reverse conversion using the longest-match algorithm for complex phonetics (e.g., `she`, `gn´e`). - **Laravel Integration**: Facades, Traits, and Service Providers included. - **Customizable**: Publish and modify the letter mapping as needed. ## Installation You can install the package via composer: ```bash composer require yafet/amharic-transliteration ``` For local development or if the package is in a private folder: ```json "repositories": [ { "type": "path", "url": "./packages/amharic-transliteration" } ], "require": { "yafet/amharic-transliteration": "*" } ``` ## Usage ### 1. Using the Facade The simplest way to use the package is via the `Amharic` facade. ```php use Yafet\AmharicTransliteration\Facades\Amharic; // Amharic to English $english = Amharic::transliterate("ላም"); // Result: "lam" // English to Amharic $amharic = Amharic::reverseTransliterate("lam"); // Result: "ላም" ``` ### 2. Using the Trait in Models Add the `Transliteratable` trait to your Eloquent models to easily convert attributes. ```php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Yafet\AmharicTransliteration\Traits\Transliteratable; class Post extends Model { use Transliteratable; protected $fillable = ['title_am']; // Get English transliteration of the title public function getTitleEnAttribute() { return $this->transliterateAttribute('title_am'); } } ``` ### 3. Manual Service Injection ```php use Yafet\AmharicTransliteration\TransliterationService; public function __construct(TransliterationService $service) { $this->service = $service; } public function convert() { return $this->service->transliterate("ሀሎ"); } …

Languages

Licenses