Repository navigation
Remove fragments from Yoruba stop words (#14036) - #14037
adedejimakinde wants to merge 1 commit into
Conversation
chrikrah
left a comment
There was a problem hiding this comment.
CI will stop this on one mechanical thing. blocking: both files end without a trailing newline. ruff format spacy --check is the first check in the Validate job (.github/workflows/tests.yml:39), and tests declares needs: Validate. No checks have run here yet. The workflows seem to need a maintainer first, so this is what the ruff step will report.
$ python -m pip install ruff -c requirements.txt && ruff --version # requirements.txt says ruff>=0.9.0
ruff 0.16.10
$ ruff format spacy --check
886 files already formatted # 26b4d1dc, your merge base
886 files already formatted # c2dabfce, master today
2 files would be reformatted, 885 already formatted # c97111fc
--> spacy/lang/yo/stop_words.py:11:2
--> spacy/tests/lang/yo/test_stop_words.py:61:30
$ ruff check spacy --select I
All checks passed! # c97111fc, the isort job is fine
The substance holds up:
$ python -m pytest spacy/tests/lang/yo -q -p no:randomly
39 passed # c97111fc
9 passed # 26b4d1dc, so your file is the +30
$ git checkout 26b4d1dc -- spacy/lang/yo/stop_words.py # your test file kept
25 failed, 14 passed # the 24 fragments, and the combining-mark guard
# spaCy 3.8.16 from this tree, CPython 3.12.3. not run: the Windows and macOS legs of the matrix
non-blocking: FRAGMENTS holds 24 entries and the set loses exactly 24, so the tests cover every removal. 14 single-character entries survive, and SINGLE_CHAR_WORDS names 4. That leaves a m n o á é ú ǹ ẹ ọ in neither list.
@adedejimakinde, ruff format spacy/lang/yo/stop_words.py spacy/tests/lang/yo/test_stop_words.py fixes both files in place. The unscoped form rewrites three more files on older ruff. Of those 14, a m n o are bare letters like the e i u you dropped. Which of them belong in SINGLE_CHAR_WORDS?
Description
Fixes #14036.
The Yorùbá stop word list contained 24 entries that are not standalone words: three bare combining marks (U+0300, U+0301, U+0323), fourteen isolated consonants (b, d, f, g, j, k, l, p, r, s, t, w, y, ṣ), and seven vowels that only occur inside words (à, e, è, i, ì, u, ù). These look like the result of splitting text that wasn't Unicode normalised.
This PR removes them, taking the list from 91 to 67 entries. Single-character entries that are real Yorùbá words are kept, for example ó (he/she/it), ń (progressive marker), ò (negation), and the object pronouns á, é, í, ú.
It also adds
spacy/tests/lang/yo/test_stop_words.py, which checks that every stop word is NFC normalised, that no entry starts with a combining mark, that the removed fragments stay out, and that real single-character words stay in.I ran the new tests against spaCy 3.8.16 before and after the change: 25 failed and 5 passed with the original list, and all 30 passed with the fixed list.
Types of change
Bug fix (language data)
Checklist