Git Product home page Git Product logo

stemmerpackage's Introduction

PHP ISRI Stemmer

The first free and open source Arabic stemmer ever written in PHP for Laravel framework implementing ISRI algorithm.

Due to lack of support for Arabic language despite its wonderful features and grammar, and as an Arabian open source tech geek in love with technologies, I felt like it's my duty to help my native language to rise, and help making Arab programmers life a bit easier.

This package contains the ISRI Stemming class build from scratch by myself and willing to make this project for global PHP use (not restricted to Laravel) next step will be Symfony 😍 .

Please note that this is just the beginning, and I'm willing to continue building a project that will serve the whole Arab language.

Install

You can install this package using composer:

composer require nouralhadi/stemmer

For Laravel < 5.5, You should add the package to your service providers array in config/app.php:

\Nouralhadi\Stemmer\StemmerServiceProvider::class,

How to use

You can visit this route /stemmer after installing this package to access the testing page of the package.

The only feature it contains (for now) is the stem feature, which accepts an arabic word and return its root.

You can use the Stemmer class by Injecting it inside your caller function / controller:

use Nouralhadi\Stemmer\Http\Helpers\ISRIStemmer;
public function test(ISRIStemmer $stemmer){
    $string = 'وزراء';
    echo $stemmer->stem($string);
    // Resulting: وزر
} 

Or you can stem a complete sentence by splitting into words and steam each:

use Nouralhadi\Stemmer\Http\Helpers\ISRIStemmer;
public function test(ISRIStemmer $stemmer){
    $string = 'كتب المستخدم رسالة إلى مدير الموقع';
    $words = mb_split(' ',$string);
    
    $ret = [];
    foreach ($words as $word){
        array_push($ret, $this->Stemmer->stem($word));
    }
    $result = implode(' ', $ret);
    // Resulting: كتب خدم رسل ألى دير وقع 
}

Contribute

Anyone willing to contribute to this project is welcomed, any help of any kind will be appreciated, and if you're ready to help then please reach out to my personal email [email protected].

License

This Project is an open-sourced software licensed under the GPLv3 License.

stemmerpackage's People

Contributors

nouralhadi avatar nouralhadi9 avatar

Stargazers

Osama Salama avatar  avatar Mohammed Abdallah avatar Wasim Alhajebi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.