Allow more flexible char substitutes#5
Merged
insolor merged 4 commits intopymorphy2-fork:masterfrom Aug 17, 2023
Merged
Conversation
insolor
reviewed
Aug 13, 2023
insolor
reviewed
Aug 13, 2023
insolor
reviewed
Aug 13, 2023
insolor
reviewed
Aug 13, 2023
Member
|
Also, it would be nice if you add tests for this functionality |
Contributor
Author
|
Added tests. Please note, however, that I hadn't yet tested my changes locally (I have no tools needed to build C++ Python extensions), so someone needs to run tests before merging (ideally, GitHub Actions; I'll look into it later) |
Member
|
CI works, it just needed apporoval to run for a first-time contributor (now I've changed the settings a bit). Ignore 2.7 tests for now, probably I'll just turn off testing on 2.7. Other tests really fall after your changes (I didn't check, if that were new tests, or some old tests are broken). You can use github codespaces to run tests not locally. |
Member
|
Ok, I'll merge it today |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
(see also: pytries/DAWG-Python#4 )
The Russian (е≈ё) and Ukrainian/Belorussian/Rusyn (г≈ґ) orthographies allow some optional letter usage, but it is generally limited to a single "marked" variation of an "unmarked" letter.
However, the orthographies of other Slavic languages require slightly more sophisticated logic for diacritic restoration. Czech has
u/ú/ůande/é/ě; Slovak haso/ó/ô,a/á/ä, andl/ĺ/ľ; Polish hasz/ź/ż. The Interslavic constructed language even has three "marked" variations of a single letter:e/ę/ě/ė. (not to mention tonal transcription systems used for Southern Slavic languages)My fix is relatively straightforward: allow each element of
replace_charsto be a list instead of a single char. The performance penalty should be negligible and the backward compatibility should be unaffected.(EDIT: I hoped everything to be validated by tests via CI, but apparently it doesn't work currently)