-
Notifications
You must be signed in to change notification settings - Fork 27
Add the initial version of the Polish stemmer #29
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
Open
tomek-ai
wants to merge
1
commit into
snowballstem:main
Choose a base branch
from
tomek-ai:polish-stemmer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Błażej Kubiński | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
[% header('Polish stemming algorithm') %] | ||
|
||
<h2>Links to resources</h2> | ||
|
||
<ul> | ||
[% algorithm_lis('polish', 'Polish') %] | ||
</ul> | ||
|
||
[% algorithm_vocab([20, 'babicka', 'maaru']) %] | ||
|
||
<h2>The stemming algorithm</h2> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the origin of the algorithm? If there's a paper or a description of it somewhere, it's helpful to reference it. If it's just something you devised, that's OK but it's useful to say that (and really you should get credit for creating it). |
||
|
||
<p> | ||
The Polish alphabet includes the following additional letters, | ||
</p> | ||
|
||
<DL><DD> | ||
<B><I>ą ę ó ł ć ś</I></B> | ||
</DL> | ||
|
||
<p> | ||
The following letters are vowels: | ||
</p> | ||
|
||
<DL><DD> | ||
<B><I>a ą e ę i o ó u y</I></B> | ||
</DL> | ||
|
||
|
||
<p> | ||
Do each of steps 1, 2, 3, 4, 5, 6 and 7. | ||
</p> | ||
|
||
<p> | ||
<B>Step 1. Remove nouns:</B> | ||
</p> | ||
|
||
<DL><DD> | ||
<DL> | ||
<DT>(<I>a</I>) | ||
If a length of the word is over 7 letters and the ending is one of the following: | ||
<B><I>zacja zacją zacji</I></B> | ||
<DD>delete the ending | ||
<DT>(<I>b</I>) | ||
If a length of the word is over 6 letters and the ending is one of the following: | ||
<B><I>acja acji acją tach anie enie eniu aniu</I></B> | ||
<DD>delete the ending | ||
<DT>(<I>c</I>) | ||
If a length of the word is over 6 letters and the ending is: | ||
<B><I>tyka</I></B> | ||
<DD>delete the last 2 letters | ||
<DT>(<I>d/I>) | ||
If a length of the word is over 5 letters and the ending is one of the following: | ||
<B><I>ach ami nia niu cia ciu cji cja cją | ||
ce ta</I></B> | ||
<DD>delete the ending | ||
</DL> | ||
</DL> | ||
|
||
<p> | ||
<B>Step 2. Remove dimunitive:</B> | ||
</p> | ||
|
||
<DL><DD> | ||
<DL> | ||
<DT>(<I>a</I>) | ||
If a length of the word is over 6 letters and the ending is one of the following: | ||
<B><I>eczek iczek iszek aszek uszek</I></B> | ||
<DD>delete the ending | ||
<DT>(<I>b</I>) | ||
If a length of the word is over 6 letters and the ending is one of the following: | ||
<B><I>enek ejek erek</I></B> | ||
<DD>delete the last 2 letters | ||
<DT>(<I>c</I>) | ||
If a length of the word is over 4 letters and the ending is one of the following: | ||
<B><I>ek ak </I></B> | ||
<DD>delete the ending | ||
</DL> | ||
</DL> | ||
|
||
<p> | ||
<B>Step 3. Remove adjectives endings:</B> | ||
</p> | ||
|
||
<DL><DD> | ||
<DL> | ||
<DT>(<I>a</I>) | ||
If a length of the word is over 7 letters, word begins with <B><I>naj</I></B> and the ending is one of the following: | ||
<B><I>sze szy szych</I></B> | ||
<DD>delete the beginning <B><I>(naj)</I></B> and the ending | ||
<DT>(<I>b</I>) | ||
If a length of the word is over 6 letters and the ending is: | ||
<B><I>czny</I></B> | ||
<DD>delete the ending | ||
<DT>(<I>c</I>) | ||
If a length of the word is over 5 letters and the ending is one of the following: | ||
<B><I>owy owa owe ych ego ej</I></B> | ||
<DD>delete the ending | ||
</DL> | ||
</DL> | ||
|
||
<p> | ||
<B>Step 4. Remove verbs endings:</B> | ||
</p> | ||
|
||
<DL><DD> | ||
<DL> | ||
<DT>(<I>a</I>) | ||
If a length of the word is over 5 letters and the ending is one of the following: | ||
<B><I>bym esz asz cie eść aść łem amy emy</I></B> | ||
<DD>delete the ending | ||
<DT>(<I>b</I>) | ||
If a length of the word is over 3 letters and the ending is: | ||
<B><I>aj</I></B> | ||
<DD>delete the last letter | ||
<DT>(<I>c</I>) | ||
If a length of the word is over 3 letters and the ending is one of the following: | ||
<B><I>ać em am ał ił ić ąc</I></B> | ||
<DD>delete the last 2 letters | ||
</DL> | ||
</DL> | ||
|
||
<p> | ||
<B>Step 5. Remove adverbs endings:</B> | ||
</p> | ||
|
||
<DL><DD> | ||
<DL> | ||
<DT>(<I>a</I>) | ||
If a length of the word is over 4 letters and the ending is one of the following: | ||
<B><I>nie wie rze</I></B> | ||
<DD>delete the the last 2 letters | ||
</DL> | ||
</DL> | ||
|
||
<p> | ||
<B>Step 6. Remove plural forms:</B> | ||
</p> | ||
|
||
<DL><DD> | ||
<DL> | ||
<DT>(<I>a</I>) | ||
If a length of the word is over 4 letters and the ending is one of the following: | ||
<B><I>ów om ami</I></B> | ||
<DD>delete the the ending | ||
</DL> | ||
</DL> | ||
|
||
<p> | ||
<B>Step 7. Remove general endings:</B> | ||
</p> | ||
|
||
<DL><DD> | ||
<DL> | ||
<DT>(<I>a</I>) | ||
If a length of the word is over 4 letters and the ending is one of the following: | ||
<B><I>ia ie u ą i a ę y ę ł</I></B> | ||
<DD>delete the the ending | ||
</DL> | ||
</DL> | ||
|
||
<h2>The same algorithm in Snowball</h2> | ||
|
||
[% highlight_file('polish') %] | ||
|
||
[% footer %] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing seems to actually reference this file, and the PR against the snowball repo doesn't mention this licence.
The Snowball compiler and other algorithms are all released under the 3-clause BSD licence, which is also a permissive licence and really pretty similar in practical terms (it does have an additional "no endorsements" clause, but that shouldn't make a difference to any reasonable use).
Are you happy to just license under 3-clause BSD? I'm not keen to have licence proliferation within the Snowball distribution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomek-ai @tomeklysiak Please respond to this part at least - can we drop this file (i.e.
algorithms/polish/LICENSE
)?The PR to add the stemmer to the snowball repo didn't include it, so the stemmer code seems to be implicitly being contributed under the licence of the snowball repo, which is 3-clause BSD.
So it seems this is just meant to apply to the algorithm description in this PR. Whatever is meant, I really don't want to have a proliferation of licences in the project (and it would be unhelpful to have to think about licensing if, for example, we later wanted to reuse parts of the algorithm description as code comments).
It would be useful to respond to my other question too, but that one isn't really a blocker to merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ojwb @mitya57 The PR was created more than three years ago, but from what I remember, the Polish stemmer logic originates from an MIT-licensed Python project. The implementation in Snowball was created independently, using the same principles but rewritten from scratch and adapted to Snowball’s structure. The MIT license was included as an acknowledgment of the original inspiration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for clarifying.
That's all fine, I'll adjust the documentation to credit the creator and link to the original repo. We should be able to get this merged.