When run on my system i get errors from preg_split
"Compilation failed: missing terminating ] for character class at offset 27 "

I fiddled around some using your example-code at the bottom of your module and found out that some of the umlauts in that expression are causing this issue.

Workaround #1
de_stemmer.module
@@ -28 +28 @@
-return preg_split('/([^a-zA-ZÄÖÜßäëïöüáéíóúè]+)/u', $text, -1, PREG_SPLIT_NO_EMPTY);
+return preg_split('/([^a-zA-ZÄÖÜßäöüáóú]+)/u', $text, -1, PREG_SPLIT_NO_EMPTY);

But that is bad in case you get words with these umlauts. So i thought i turn it around into:

Workaround #2
de_stemmer.module
@@ -28 +28 @@
-return preg_split('/([^a-zA-ZÄÖÜßäëïöüáéíóúè]+)/u', $text, -1, PREG_SPLIT_NO_EMPTY);
+return preg_split('/([,\.; -\/\[\]><:\'\"]+)/u', $text, -1, PREG_SPLIT_NO_EMPTY);

So i set up a pile of possible in-text non alphanumeric characters to search and split at.

btw. i have to stick to a rather old PHP 4.3.3 so that might be the cause of my problems. But with this solution i can work with your fine extension. I also added some more stopwords and exeptions for the technical documents i have to search through.

Comments

Archetrix’s picture

Another issue:

Some german sentences begin with a (upper-case) stopword and in

function de_stemmer_search_preprocess (&$text) {..}

_de_stemmer_stoppwort gets called before _de_stemmer_wortstamm where "strtolower" is finally applied to each word.

So stopword-matching fails on all upper case stopwords.

In
function _de_stemmer_stoppwort($wort) {..}

its better to use case-lowering on $wort before matching it against $stoppworte

schildi’s picture

Title: preg_split on line 28 fires error: Compilation failed: missing terminating ] for character class at offset 27 » Separating words and stop-word problem

Thanks for your work and
sorry for being absent a long time.

I will check your patch / hints as soon as possible.

Regards
Schildi

P.S.
Are your added exception words of common interest?

schildi’s picture

Version: 5.x-1.0 » 6.x-1.1
Status: Needs review » Fixed

Should be solved.
Please compare new release rc1.
The code for Drupal-6 should be usable in D5 without a harm.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.