kaungkhantjc / myanmar-wikipedia-faker
A high-performance Myanmar (Burmese) text generator based on the DatarrX Wikipedia Dataset.
Package info
github.com/kaungkhantjc/myanmar-wikipedia-faker
pkg:composer/kaungkhantjc/myanmar-wikipedia-faker
Requires
- php: ^8.4 || ^8.5
- ext-zlib: *
- fakerphp/faker: ^1.24
Requires (Dev)
- pestphp/pest: ^5.0
README
Myanmar Wikipedia Faker
A high-performance Myanmar (Burmese) text generator. Requires PHP 8.4+. It provides a Faker provider built from the DatarrX Myanmar Wikipedia dataset and uses a binary byte-offset map index for true $O(1)$ time complexity, $O(1)$ memory usage, and instant random access.
Quick install
composer require kaungkhantjc/myanmar-wikipedia-faker
Usage (plain PHP)
$faker = \Faker\Factory::create(); $faker->addProvider(new \Kaungkhantjc\Faker\MyanmarWikipediaTextProvider($faker)); echo $faker->myanmarWikipediaText();
Laravel integration
-
Install package:
composer require kaungkhantjc/myanmar-wikipedia-faker --dev
-
Create and register the provider for Laravel's Faker globally.
# In Laravel 13, providers are automatically registered to the bootstrap/providers.php when created via the Artisan CLI php artisan make:provider FakerServiceProvider -
Add the following code to the
registermethod of the newly createdFakerServiceProvider:if (!app()->environment(['local', 'testing'])) return; $this->app->afterResolving(\Faker\Generator::class, function (\Faker\Generator $faker) { $faker->addProvider(new \Kaungkhantjc\Faker\MyanmarWikipediaTextProvider($faker)); });;
After this, fake()->myanmarWikipediaText() will be available in tinker, factories, seeders and tests.
Rebuilding Dataset from Source (for contributors)
If you need to rebuild the .gz dataset from Hugging Face:
-
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\Activate.ps1
-
Install dependencies and run build script:
pip install pyarrow python scripts/build_dataset.py
When finished, deactivate with deactivate.
The script downloads and caches resources/data.parquet locally and streams memory-efficient row batches into compressed native files (myanmar_sentences.txt.gz, offsets.bin.gz, and line_count.txt).
Testing
composer test
Credits
Dataset: Myanmar Wikipedia Dataset (20260501) by Khant Sint Heinn (DatarrX) — released under CC-BY-4.0.
License
This project is licensed under the MIT License. See the LICENSE file for details.
