PHP code example of helturkey / dujana-arabic-nlp

1. Go to this page and download the library: Download helturkey/dujana-arabic-nlp 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 / dujana-arabic-nlp example snippets


use Dujana\ArabicNlp\ArabicAnalyzer;
use Dujana\ArabicNlp\ArabicClassifier;
use Dujana\ArabicNlp\ArabicTokenizer;
use Dujana\ArabicNlp\Enums\StemmerModeEnum;

$tokens = ArabicTokenizer::make()->tokenize('أَحْلَامُهُمْ كَثِيرَةٌ.');

$classification = ArabicClassifier::make()->classify('أَحْلَامَهُمْ');

$analysis = ArabicAnalyzer::make()->analyze('أَحْلَامَهُمْ', StemmerModeEnum::Root);

use Dujana\ArabicNlp\ArabicAnalyzer;
use Dujana\ArabicNlp\ArabicClassifier;
use Dujana\ArabicNlp\ArabicTokenizer;
use Dujana\ArabicNlp\Enums\StemmerModeEnum;

$tokens = app(ArabicTokenizer::class)->tokenize('أَحْلَامُهُمْ كَثِيرَةٌ.');

$classification = app(ArabicClassifier::class)->classify('أَحْلَامَهُمْ');

$analysis = app(ArabicAnalyzer::class)->analyze('أَحْلَامَهُمْ', StemmerModeEnum::Root);

$analyzer->tokenize($text);                         // Tokenization
$analyzer->classify($word);                         // Classification
$analyzer->stem($word, StemmerModeEnum::Moderate);  // Stemming
$analyzer->analyze($word, StemmerModeEnum::Root);   // Full analysis

ArabicTokenizer::make()->tokenize($text);
ArabicClassifier::make()->classify($word);
ArabicStemmer::make()->stem($word, StemmerModeEnum::Moderate);
ArabicAnalyzer::make()->analyze($word, StemmerModeEnum::Root);
bash
php artisan vendor:publish --tag=dujana-arabic-nlp