-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mistakes in the Dutch stemmer #1
Comments
Sorry not to have responded sooner; I'll try and take a look at this within the next week. |
@rboulton Did you manage to take a look at this? As a general point, the aim of these stemmers is not to map their inputs to words in the same language, but rather to map different forms of the same word to the same string of characters (and forms of different words to different strings of characters). It just happens that in many cases the outputs are words in the same language. So it isn't necessarily an error to be mapping |
I have the same experience with the 'Dutch' Snowball stemmer. Much better stemming is realised using the 'Kraaij-Pohlmann' stemming algoritm (language="Kp"). The simplest improvement is to use this algoritm as the default for Dutch stemming. |
I agree with @ojwb that it is not a problem if the stemmer does not map to existing words, as long a it does not map to an existing word with a different meaning. Here a few examples comparing "Dutch" language with "Kp" language. Using:
Using:
Of course I have picked examples where the stemming fails, but I have found only one category where "Kp" language fails: Irregular verbs. But all together the "Kp" Kraaij-Pohlmann algorithm is a much better stemming than the obvious choice of "Dutch" language. Instead of fixing the Dutch stemming, I recommend to replace it by the "Kp" stemming. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I am not a good Dutch speaker but I can see from the examples that some plural nouns are not stemmed correctly in the example diff for Dutch. For example, I understand that It would seem that this rule is missing entirely. |
This comment has been minimized.
This comment has been minimized.
I brought this matter up on the list recently: https://lists.tartarus.org/pipermail/snowball-discuss/2019-October/001658.html The history here is that Martin implemented Helpfully Martin managed to find a copy of the original C implementation from Kraaij and Pohlmann, which means we can look at the discrepancies between that and https://snowballstem.org/algorithms/kraaij_pohlmann/stemmer.html claims "in the demonstration vocabulary only 32 words out of over 45,000 stem differently" and goes on to list them (and a significant number appear to be non-Dutch words) but if I attempt to repeat that comparison I get 220 differences. One obvious difference from looking at the sources is that the C version includes vowels with accents whereas the Snowball version only considers unaccented vowels - a quick attempt to copy that in Snowball reduced the differences from 220 to 153. I'll see if I can usefully summarise the differences so people can easily take a look. If anyone knows of a good quality Dutch word list, that might be useful - |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I think I've finally got to the bottom of this discrepancy. The C implementation Kraaij-Pohlmann works in iso-8859-1 (with accented characters encoded as octal escapes, e.g. The comparison is invalid due to the encoding confusion. The Snowball kraaij_pohlmann omits all rules using with letters with diacritics, but because of the encoding confusion these rules in the C implementation didn't fire in the old testing. So there really are 220 differences on our wordlist. That's still not a huge number, but I think it would make sense to try to fully align the Snowball implementation with the C one (or at least close the gap significantly). I'll adjust the text on the website. |
Both the current |
Checking these examples with
Some of these do look better than
It does seem the Kraaij-Pohlmann algorithm is too aggressive at removing I don't think this sinks the idea of making Kraaij-Pohlmann the default, but it would be good if we could find a way to adjust it in this area, and it would be better to do that at the same time as fixing it to handle diacritics (more) like the C implementation and making it the default since then all the changes to stemming of "dutch" happen in one go. |
The C implementation only removes the -es part but the Snowball implementation was removing the whole of -ares/-eres. This reduces the number of differences in the output from the two implementations when run on our test vocabulary from 220 to 212. See #1
Commit linked just above reduces the number of differences from 220 to 212. |
Sadly I failed to find that previous attempt but I seem to have managed to recreate it - thanks to the reduction of 8 above that takes us down to 145 differences. Will tidy up and merge tomorrow. |
Implement handling of diacritics on vowels to match the C implementation. Reduces the number of words from the test vocabulary which stem differently from 212 to 145. See #1
Reduces the number of words which stem differently from 145 to 138. See #1
Reduces the number of words which stem differently from 138 to 65. See #1
The Snowball implementation tries to identify cases where `y` is a consonant and temporarily changes these to `Y` which is then treated as a consonant during stemming (then `Y` is changed back to `y` before returning). However the original C Kraaij-Pohlmann implementation does not do this (it's taken from the Porter stemmers for English, French, German and Dutch). A quick scan of the stemming differences resulting from this change suggests that the this extra handling only helps by conflating `royale` with `royaal` but possibly there are additional cases and this extra tweak is useful. However it's getting in the way of resolving the differences between the C and Snowball implementations so remove at least for now and review later. This reduces the number of words which stem differently from 65 to 45. See #1
This reduces the number of words which stem differently from 45 to 8. See #1
Down to just 8 differences now on the test vocabulary:
It looks like there are probably some common causes here. Comparing the stems from the C version to the Snowball version gives:
|
This reduces the number of words which stem differently from 8 to 6. See #1
This reduces the number of words which stem differently from 6 to 5. See #1
This reduces the number of words which stem differently from 5 to 2. See #1
This reduces the number of words which stem differently from 2 to 1. See #1
The Snowball implementation now produces the same stems for all words in our sample vocabulary list. See #1
The Snowball implementation now produces the same stems for all words in our sample vocabulary list. This list is probably on the short side though, so I extracted a much larger list of 2004127 words from Dutch wikipedia and wiktionary and tested with that. I had to fix
|
Fixes handling of `lagerweij` to match C implementation. See #1
The snowball implementation now produces identical stems to the original C implementation (with some undefined behaviour fixed) for a very large range of Dutch words, and also for words from all the other language vocabularies we have. My plan is to change to use Kraaij-Pohlmann for "dutch"/"nl", add an alias for people who want to select Martin Porter's "dutch" stemmer, and update the website documentation to reflect this. We also should have a more thorough document about the Kraaij-Pohlmann stemmer than we currently do, so I'll work on that. That will address almost all of the issues raised here, so then we can close this ticket. I've noted a few cases where the Kraaij-Pohlmann stemmer seems to conflate cases which seem problematic - e.g. the worst is probably that |
See #208. |
I first want to thank everyone on the Snowball project for creating this software. It's great that we can use the software to build more sophisticated search capabilities for our users. However, when I was testing several Dutch words, I noticed there are actually quite a lot of mistakes. I'm not quite sure how to fix the problems in the Dutch stemmer, so I thought I'd mentioned them here and hope someone picks it up.
Not sure where to start, so I'll mention a couple that are incorrect (the last word is the correct one):
These are just a few, but there are quite a lot more. Should you need help verifying or testing the stemmer for the Dutch words, I'm happy to help :)
The text was updated successfully, but these errors were encountered: