Giter Club home page Giter Club logo

php-stemmer's Introduction

php-stemmer

PHP native implementation of Snowball stemmer https://snowballstem.org/

Accept only UTF-8

Languages

Available :

  • Catalan (by Orestes Sanchez Benavente [email protected])
  • Danish
  • Dutch
  • English
  • Finnish (by Mikko Saari)
  • French
  • German
  • Italian
  • Norwegian
  • Portuguese
  • Romanian
  • Russian
  • Spanish
  • Swedish

Installation

For PHP5, use 1.3

composer require wamania/php-stemmer "^1.3"

For PHP7 use 2.x (branch 2.x is backward compatible with 1.x)

composer require wamania/php-stemmer "^2.0"

For PHP^7.3 and PHP^8.0 use 3.x (backward compatible, but phpunit^9 don't work with php < 7.3)

composer require wamania/php-stemmer "^3.0"

Usage

For 2.x, you should use the factory

use Wamania\Snowball\StemmerFactory;

// use ISO_639 (2 or 3 letters) or language name in english
$stemmer = StemmerFactory::create('fr');
$stemmer = StemmerFactory::create ('spanish');

// then 
$stem = $stemmer->stem('automóvil');

Or the manager

use Wamania\Snowball\StemmerManager;

$manager = new StemmerManager();
$stem = $manager->stem('automóvil', 'es');

In 1.3, you must instantiate manually

use Wamania\Snowball\French;

$stemmer = new French();
$stem = $stemmer->stem('anticonstitutionnellement');

php-stemmer's People

Contributors

hleithner avatar lcobucci avatar marclaporte avatar miceno avatar msaari avatar patrickomeara avatar sharkykz avatar wamania avatar wamaniaserveur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-stemmer's Issues

Returning wrong stem for English adjective

I'm about to fork this stemmer for my language but before I could start I just tried a word using the English stemmer.

I gave it the adjective unethical but to my surprise it returned uneth whereas it should have spitted ethic as
Can you please look into it.

How to try the basic example in the Usage instructions

Hi, sorry for the very basic issue, but I couldn't make it work.

I used composer (latest version of your stemmer) in a PHP8 environment.

Composer downloaded a 21 Mb vendor directory with autoload.php inside:
I uploaded all the vendor directory with its contents and put outside a PHP file with:

require 'vendor/autoload.php';

Then I tried to execute the basic example you provided in the front page usage section but I got a class not found error.

Is there something else I should add to the autoload? Should I directly require classes? How?

Thanks and happy new year to everybody reading.

voku/portable-utf8 dependency

Hello, thank you for your work with the stemmer. Joomla has gotten a bug report that voku/portable-utf8 has a problem on PHP 8.2. (joomla/joomla-cms#39512) It turns out that this is only used from your php-stemmer AND that voku already fixed this in their latest 6.0.x versions. From my perspective 6.0.12 should work perfectly fine with php-stemmer, since none of the code you are using has been changed in the 6.0 release. Would it be possible for you to update your composer.json to require voku/portable-utf8 to "^5.4|^6.0"? That would help us with Joomla 5.0.

The big question would be, if you could also do another release for 2.x with that change as well. Then we could fix this issue in Joomla 4.x as well. Thank you!

PHP 8.2 and voku/portable-utf8

Hi there! I'm in the process of upgrading to PHP 8.2. Getting the following warnings:

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /vendor/voku/portable-utf8/src/voku/helper/UTF8.php on line 4653

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /vendor/voku/portable-utf8/src/voku/helper/UTF8.php on line 4664

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /vendor/voku/portable-utf8/src/voku/helper/UTF8.php on line 5731

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /vendor/voku/portable-utf8/src/voku/helper/UTF8.php on line 5742

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /vendor/voku/portable-utf8/src/voku/helper/UTF8.php on line 13398

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /vendor/voku/portable-utf8/src/voku/helper/UTF8.php on line 13398

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /vendor/voku/portable-utf8/src/voku/helper/UTF8.php on line 13409

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /vendor/voku/portable-utf8/src/voku/helper/UTF8.php on line 13409

I checked the latest release of voku/portable-utf8 and it seems like this has been fixed on their end. Could it be possible that you could fix this by updating the dependency in your composer.json to the version that fixes this?

"voku/portable-utf8": "^5.4|^6.0"

Thanks a lot for your help!

Not all English step methods are private

stem() should be the only public method, but the following ones are also exposed:

public function step3()
public function step4()
public function step5()
public function finish()

php 7.4

We discovered joomla/joomla-cms#27329 that the code in the utf8.php file is not compatible with php7.4 as it produces several deprecated notices like this

PHP Deprecated: Array and string offset access syntax with curly braces is deprecated

Is this something that is resolved in v2? Is v2 backwards compatible?

Releases in packagist

Hello,

Packagist is not showing any releases for this project. I can only use dev-master while checking out the project from packagist.

FYI: I'm adding the Finnish stemmer

I noticed the work on the Finnish stemmer hasn't moved along in a long time. I need one, so I started working on it. Just so you know; I'll send in a pull request when I'm done.

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.