Skip to content

Commit a7bb70b

Browse files
authored
Merge pull request #7 from amaccis/upgrade_2.0.0
Upgrade version to 2.0.0
2 parents 9ae1018 + 95fd1f6 commit a7bb70b

File tree

14 files changed

+760
-895
lines changed

14 files changed

+760
-895
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
container:
13-
image: amaccis/php-libstemmer:2.2.0
13+
image: amaccis/php-libstemmer:8.1-2.2.0
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717
- name: Install dependencies
1818
run: composer install
1919
- name: Run tests
20-
run: vendor/bin/phpunit
20+
run: vendor/bin/phpunit
21+
- name: Run static analysis
22+
run: vendor/bin/phpstan

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
vendor
22
.idea
33
.phpunit.result.cache
4+
.phpunit.cache
45
coverage

README.md

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# php-stemmer
22

3-
[![PHP Version](https://img.shields.io/badge/php-%5E7.4%7C%5E8.0-blue.svg)](https://img.shields.io/badge/php-%5E7.4%7C%5E8.0-blue.svg)
3+
[![PHP Version](https://img.shields.io/badge/php-%5E8.1-blue.svg)](https://img.shields.io/badge/php-%5E8.1-blue.svg)
44
![CI](https://github.com/amaccis/php-stemmer/workflows/CI/badge.svg)
55

66
## What is PHP Stemmer?
77
PHP Stemmer is a PHP interface to the stemming algorithms from the [Snowball project](https://snowballstem.org/), largely inspired by Richard Boulton's [PyStemmer](https://github.com/snowballstem/pystemmer).
88
It uses FFI (PHP >= 7.4.0) and expects to find the file libstemmer.so (a version of [Libstemmer](https://snowballstem.org/dist/libstemmer_c.tgz) compiled as shared library) in LD_LIBRARY_PATH.
9-
In order to set-up this kind of environment you can take a look at [docker-php-libstemmer](https://github.com/amaccis/docker-php-libstemmer) Dockerfile or you can use the corresponding docker image: [amaccis/php-libstemmer](https://hub.docker.com/r/amaccis/php-libstemmer)
9+
In order to set up this kind of environment you can take a look at [docker-php-libstemmer](https://github.com/amaccis/docker-php-libstemmer) Dockerfile or you can use the corresponding docker image: [amaccis/php-libstemmer](https://hub.docker.com/r/amaccis/php-libstemmer)
1010

1111
## Installation
1212

@@ -23,74 +23,90 @@ composer require amaccis/php-stemmer
2323
<?php
2424

2525
use Amaccis\Stemmer\Stemmer;
26+
use Amaccis\Stemmer\Enum\CharacterEncodingEnum;
2627

2728
$algorithms = Stemmer::algorithms();
2829
var_dump($algorithms);
2930
/*
30-
array(26) {
31-
[0]=>
31+
array(29) {
32+
[0] =>
3233
string(6) "arabic"
33-
[1]=>
34+
[1] =>
35+
string(8) "armenian"
36+
[2] =>
3437
string(6) "basque"
35-
[2]=>
38+
[3] =>
3639
string(7) "catalan"
37-
[3]=>
40+
[4] =>
3841
string(6) "danish"
39-
[4]=>
42+
[5] =>
4043
string(5) "dutch"
41-
[5]=>
44+
[6] =>
4245
string(7) "english"
43-
[6]=>
46+
[7] =>
4447
string(7) "finnish"
45-
[7]=>
48+
[8] =>
4649
string(6) "french"
47-
[8]=>
50+
[9] =>
4851
string(6) "german"
49-
[9]=>
52+
[10] =>
5053
string(5) "greek"
51-
[10]=>
54+
[11] =>
5255
string(5) "hindi"
53-
[11]=>
56+
[12] =>
5457
string(9) "hungarian"
55-
[12]=>
58+
[13] =>
5659
string(10) "indonesian"
57-
[13]=>
60+
[14] =>
5861
string(5) "irish"
59-
[14]=>
62+
[15] =>
6063
string(7) "italian"
61-
[15]=>
64+
[16] =>
6265
string(10) "lithuanian"
63-
[16]=>
66+
[17] =>
6467
string(6) "nepali"
65-
[17]=>
68+
[18] =>
6669
string(9) "norwegian"
67-
[18]=>
70+
[19] =>
6871
string(6) "porter"
69-
[19]=>
72+
[20] =>
7073
string(10) "portuguese"
71-
[20]=>
74+
[21] =>
7275
string(8) "romanian"
73-
[21]=>
76+
[22] =>
7477
string(7) "russian"
75-
[22]=>
78+
[23] =>
79+
string(7) "serbian"
80+
[24] =>
7681
string(7) "spanish"
77-
[23]=>
82+
[25] =>
7883
string(7) "swedish"
79-
[24]=>
84+
[26] =>
8085
string(5) "tamil"
81-
[25]=>
86+
[27] =>
8287
string(7) "turkish"
88+
[28] =>
89+
string(7) "yiddish"
8390
}
8491
*/
8592

8693
$algorithm = "english";
8794
$word = "cycling";
88-
$stemmer = new Stemmer($algorithm);
95+
$stemmer = new Stemmer($algorithm); // default character encoding is UTF-8
8996
$stem = $stemmer->stemWord($word);
9097
var_dump($stem);
9198
/*
9299
string(4) "cycl"
93100
*/
101+
102+
$algorithm = "basque";
103+
$word = "aberatsenetakoa";
104+
$stemmer = new Stemmer($algorithm, CharacterEncodingEnum::ISO_8859_1);
105+
$stem = $stemmer->stemWord($word);
106+
var_dump($stem);
107+
/*
108+
string(8) "aberatse"
109+
*/
94110
```
95111

96112
## License

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
}
2121
},
2222
"require": {
23-
"php": "^7.4 || ^8.0",
23+
"php": "^8.1.0",
2424
"ext-ffi": "*"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "^9.5",
28-
"phpstan/phpstan": "^0.12"
27+
"phpunit/phpunit": "^10.1",
28+
"phpstan/phpstan": "^1.10",
29+
"ext-iconv": "*"
2930
}
3031
}

0 commit comments

Comments
 (0)