Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
max-parallel: 1
matrix:
container:
- "amaccis/php-libstemmer:8.1.31-2.2.0"
- "amaccis/php-libstemmer:8.2.27-2.2.0"
- "amaccis/php-libstemmer:8.3.15-2.2.0"
- "amaccis/php-libstemmer:8.4.2-2.2.0"
- "amaccis/php-libstemmer:8.1.32-3.0.0"
- "amaccis/php-libstemmer:8.2.28-3.0.0"
- "amaccis/php-libstemmer:8.3.20-3.0.0"
- "amaccis/php-libstemmer:8.4.6-3.0.0"

container:
image: ${{ matrix.container }}
Expand Down
44 changes: 26 additions & 18 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
displayDetailsOnTestsThatTriggerDeprecations="true">
<coverage/>
<testsuites>
<testsuite name="Tests">
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/Libstemmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public function sbStemmerDelete(CData $sbStemmer): void
public function sbStemmerStem(CData $sbStemmer, string $word, int $size): CData
{

$c_word = FFI::new("char[$size]");
$c_word = $this->ffi->new("char[$size]");
FFI::memcpy($c_word, $word, $size);
$sb_symbol = FFI::cast($this->ffi->type('sb_symbol'), $c_word);
$sb_symbol = $this->ffi->cast($this->ffi->type('sb_symbol'), $c_word);
$word = FFI::addr($sb_symbol);

return $this->ffi->sb_stemmer_stem($sbStemmer, $word, $size);
Expand Down
42 changes: 5 additions & 37 deletions tests/StemmerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,12 @@
class StemmerTest extends TestCase
{

public function testThatAlgorithmsReturnsTheExpectedArray(): void
public function testThatAlgorithmsReturnsAnArrayNotEmpty(): void
{

$expectedAlgorithms = [
'arabic',
'armenian',
'basque',
'catalan',
'danish',
'dutch',
'english',
'finnish',
'french',
'german',
'greek',
'hindi',
'hungarian',
'indonesian',
'irish',
'italian',
'lithuanian',
'nepali',
'norwegian',
'porter',
'portuguese',
'romanian',
'russian',
'serbian',
'spanish',
'swedish',
'tamil',
'turkish',
'yiddish'
];
$algorithms = Stemmer::algorithms();
$this->assertEquals($expectedAlgorithms, $algorithms);
$this->assertIsArray($algorithms);
$this->assertNotEmpty($algorithms);

}

Expand Down Expand Up @@ -114,7 +84,7 @@ public static function stemWordUtf8CharencProvider(): array
['catalan', 'arruïnada', 'arru'],
['danish', 'afbildningerne', 'afbildning'],
['hungarian', 'lenyűgözőnek', 'lenyűgöző'],
['romanian', 'luminişurile', 'luminişur'],
['romanian', 'luminișurile', 'luminișur'],
['russian', 'взъерошенный', 'взъерошен']
];

Expand Down Expand Up @@ -174,7 +144,6 @@ public static function stemWordIso88592CharencProvider(): array

return [
['hungarian', 'lenyűgözőnek', 'lenyűgöző'],
['romanian', 'luminişurile', 'luminişur'],
];

}
Expand Down Expand Up @@ -250,7 +219,7 @@ public static function stemWordsUtf8CharencProvider(): array
['catalan', ['gratuïtament', 'cuaespinós'], ['gratuit', 'cuaespin']],
['danish', ['afbildningerne', 'linnedklæderne'], ['afbildning', 'linnedklæd']],
['hungarian', ['lenyűgözőnek', 'megháromszorozódott'], ['lenyűgöző', 'megháromszorozódot']],
['romanian', ['luminişurile', 'personalităţilor'], ['luminişur', 'personal']],
['romanian', ['luminișurile', 'personalităţilor'], ['luminișur', 'personal']],
['russian', ['взъерошенный', 'затруднительное'], ['взъерошен', 'затруднительн']],
];

Expand Down Expand Up @@ -320,7 +289,6 @@ public static function stemWordsIso88592CharencProvider(): array

return [
['hungarian', ['lenyűgözőnek', 'megháromszorozódott'], ['lenyűgöző', 'megháromszorozódot']],
['romanian', ['luminişurile', 'personalităţilor'], ['luminişur', 'personal']],
];

}
Expand Down