1. Go to this page and download the library: Download helturkey/arabic-prosody library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
helturkey / arabic-prosody example snippets
use Arud\Analyzer;
$a = new Analyzer();
// One hemistich
$a->analyze('قِفَا نَبْكِ مِنْ ذِكْرَى حَبِيبٍ وَمَنْزِلِ', side: 'sadr');
// One verse — any of these
$a->analyzeVerse($sadr, $ajuz);
$a->analyzeVerse([$sadr, $ajuz]);
$a->analyzeVerse(['sadr' => $sadr, 'ajuz' => $ajuz]);
$a->analyzeVerse("$sadr *** $ajuz");
// A poem — array of pairs, flat even list, ['verses' => …], or text
$poem = $a->analyzePoem([[$s1, $a1], [$s2, $a2], [$s3, $a3]]);
$poem->dominantMeter; // 'basit'
$poem->consistency; // 1.0
$poem->deviations; // [] (1-based verse numbers that do not fit)
// Shape detection / quick answer
$a->analyzeAuto($anything); // AnalysisResult | VerseAnalysis | PoemAnalysis
$a->detectMeter($anything); // 'tawil' | … | null (null = no trustworthy answer)
// Free-verse (tafʿīla) line
$a->analyzeFreeVerse('فَعُولُنْ فَعُولُنْ فَعُولُنْ');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.