Skip to content

fix(sefariasqlite): translate English section names leaking into Hebrew headings - #96

Merged
kdroidFilter merged 1 commit into
masterfrom
fix/sefaria-section-names-501
Oct 8, 2026
Merged

kdroidFilter merged 1 commit into
masterfrom
fix/sefaria-section-names-501

Conversation

@kdroidFilter

Copy link
Copy Markdown
Owner

Fixes kdroidFilter/Zayit#501. Headings in the Epistle of Rav Sherira Gaon showed the English "Question" instead of a Hebrew label.

Cause

Sefaria's schema for this book has heSectionNames: ["", "פסקה"]. When a Hebrew name is blank, the importer translates the English name with mapSectionNameToHebrew, which had no entry for "Question" and returned the English word. A scan of every Sefaria schema found about 40 other names leaking the same way: Comment (3,939 cases), DH, Sheilta, Gate, Ot, Word…

Changes

  • Mappings follow Sefaria's Term dictionary (/api/terms) and the Hebrew names Sefaria gives the same English name in books where heSectionNames is filled in, for example Comment → פירוש, Letter → אות, Essay → מאמר, Chamber → חדר. When there is no Term, the label is based on the book's structure: Question → שאלה, Principle → עיקר (Sefer HaBachur), Word → ערך (Machberet Menachem).
  • Matching: short names (ot, dh) must match exactly so they can't catch longer words. Quotes around names ('Comment') are removed before matching.
  • Integer: this is the name Sefaria gives a level with no real name, and Sefaria shows those sections by number only (its refs read א׳:א׳:א׳). mapSectionNameToHebrew now returns null for it, and the reader titles the heading with the bare number instead of "Integer א". A blank label still produces no heading, as before.

Tests

New SefariaSectionNameMappingTest: checks the mappings, that short names don't match inside longer words, and an end-to-end Chapter/Halakhah/Integer/Integer schema. All :sefariasqlite:jvmTest tests pass. The database was not regenerated as part of this PR.

🤖 Generated with Claude Code

…ew headings

When a schema leaves a heSectionNames entry blank, the importer falls back to
the English sectionNames through mapSectionNameToHebrew, which had no mapping
for many names: the Epistle of Rav Sherira Gaon showed "Question א"
(kdroidFilter/Zayit#501), and Comment, DH, Sheilta, Gate, Ot... leaked the same
way across the corpus.

- Map the remaining names found in the Sefaria schemas, following Sefaria's
  Term dictionary and the Hebrew names it pairs them with in other books.
- Treat "Integer" as an unnamed level and title its headings with the bare
  number, as Sefaria does in its refs and reader.

Signed-off-by: Elie Gambache <elyahou.hadass@gmail.com>
@kdroidFilter
kdroidFilter merged commit 3fa685b into master Oct 8, 2026
1 check passed
Y-PLONI added a commit to Otzaria/SeforimLibrary that referenced this pull request Oct 8, 2026
…ew headings

Port of kdroidFilter#96 (upstream 773fcc9) onto our
mapSectionNameToHebrew, which already covered part of it (7c0f0ff).

- Add the names still leaking from blank heSectionNames: DH, Pararaph,
  Passuk, Footnote, Tosefta, Midrash, Drush, Remez, Inyan, Mitzvah, Piyyut,
  Hadran, Kovetz, Gate/Sha'ar, Essay, Statement, Letter, Chamber, Window, Book.
- Treat "Integer" as an unnamed level: its headings are the bare number.
- Normalize input (lowercase, trim quotes/spaces) as upstream does.
- Keep our values where they differ (Word, Treatise, Maayan, Manuscript, Vav);
  generic English words are matched exactly, not as substrings.
Y-PLONI added a commit to Otzaria/SeforimLibrary that referenced this pull request Oct 8, 2026
…ew headings

Port of kdroidFilter#96 (upstream 773fcc9) onto our
mapSectionNameToHebrew, which already covered part of it (7c0f0ff).

- Add the names still leaking from blank heSectionNames: DH, Pararaph,
  Passuk, Footnote, Tosefta, Midrash, Drush, Remez, Inyan, Mitzvah, Piyyut,
  Hadran, Kovetz, Gate/Sha'ar, Essay, Statement, Letter, Chamber, Window, Book.
- Treat "Integer" as an unnamed level: its headings are the bare number.
- Normalize input (lowercase, trim quotes/spaces) as upstream does.
- Keep our values where they differ (Word, Treatise, Maayan, Manuscript, Vav);
  generic English words are matched exactly, not as substrings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translation issue in Iggeret Rav Sherira Gaon

1 participant