Skip to content
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

Greek stemmer bug fix #175

Merged
merged 3 commits into from
Jun 13, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
include:
# - os: "windows-2022"
# python-version: "3.10"
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ with your code. Nothing is written in stone but please try to respect them.
4. Please **respect the code style**. I don't want to set specific strict rules here because I think it's
possible to respect style from all the code around. For example you will not use `'` for strings
when you see that the code uses `"` ...
5. Make sure you have Python 3.5+ installed. Also, **Python 2.7/3.4** and maybe older versions work but since
5. Make sure you have Python 3.6+ installed. Also, **Python 2.7/3.4** and maybe older versions work but since
they reached end-of-life you could have difficulties with the transitive dependencies that dropped the support
already. Then, install all the required dependencies and run the tests:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ There is a [good chance](docs/index.md#Tokenizer) it is. But if not it is [not t

## Installation

Make sure you have [Python](http://www.python.org/) 3.5+ and
Make sure you have [Python](http://www.python.org/) 3.6+ and
[pip](https://crate.io/packages/pip/)
([Windows](http://docs.python-guide.org/en/latest/starting/install/win/),
[Linux](http://docs.python-guide.org/en/latest/starting/install/linux/))
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
],
)
2 changes: 1 addition & 1 deletion sumy/nlp/stemmers/greek.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def stem_word(word):
for tag in _TOTAL_TAGS:
try:
stemmed = gr_stemmer.stem_word(word.lower(), tag)
if stemmed[-1].upper() in _CONSONANTS:
if stemmed and stemmed[-1].upper() in _CONSONANTS:
stem_candidates.add(stemmed)
except (TypeError, ValueError):
pass
Expand Down
7 changes: 7 additions & 0 deletions tests/test_stemmers.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ def test_slovak_stemmer():

assert type(actual) is type(expected)
assert expected.__dict__ == actual.__dict__


def test_greek_stemmer():
greek_stemmer = Stemmer("greek")
# The first assert covers the empty stem case.
assert "οτ" == greek_stemmer("όταν")
assert "εργαζ" == greek_stemmer("εργαζόμενος")