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.
The
lexical_density
function does not run in Python versions more recent than 3.10. This is because of an issue in thepymorphy2
package, which is used here. See this Stack Overflow answer for details - it seems like it is using a function that has been deprecated since Python 3.0, but which was only removed in Python 3.11.Additionally
pymorphy2
is abandoned: See here.This pull request updates the code to use
pymorphy3
, which is the succcessor, still being maintained (as far as I can tell) and which fixes the issue of thelexical_density
function fromlinguaf
to not work under Python 3.11 (and most likely more recent versions as well, though I only tried it on 3.11).The tests run without any issues.
Example demonstrating the issue (using Python 3.11):
With
pymorphy2
the above code produces the following error:The same code, but using
pymorphy3
: