Skip to content

feat: add LaTeX (.tex, .bib) to readable and prose extensions - #1901

Merged
igorls merged 1 commit into
MemPalace:developfrom
messelink:feat/latex-extensions
Jun 30, 2026
Merged

feat: add LaTeX (.tex, .bib) to readable and prose extensions#1901
igorls merged 1 commit into
MemPalace:developfrom
messelink:feat/latex-extensions

Conversation

@messelink

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds .tex and .bib to the file-extension allowlists so LaTeX projects are mineable into the palace AND surface correctly during entity detection.

  • mempalace/miner.py:READABLE_EXTENSIONS — both extensions join the mining allowlist
  • mempalace/entity_detector.py:PROSE_EXTENSIONS — both extensions also join the preferred entity-detection bucket (alongside .md, .rst, .csv), not the code-file fallback

Why touch entity_detector too?

Prior extension PRs (#1368 Swift/Kotlin, #1819 PHP) touched only miner.py. The reason PROSE_EXTENSIONS exists separately from READABLE_EXTENSIONS in entity_detector.py is documented in-code: programming-language files have lots of capitalized identifiers (class names, function names) that produce false-positive person matches.

LaTeX/BibTeX are different in kind — they're typesetting languages for prose documents:

  • .tex files contain abstracts, paragraphs of natural-language content, \author{} declarations, and citations referencing real people.
  • .bib files are almost entirely author names (one author = {...} per entry, often dozens per file).

Without the entity_detector.py change, mining LaTeX projects works (post this PR) but mempalace init on a thesis or paper project would either find few prose files and fall back to all-readable, or treat .tex/.bib as part of the code-file fallback bucket alongside any actual code. Putting them in PROSE_EXTENSIONS is the correct placement.

How to test

uv run pytest tests/test_miner.py::test_scan_project_includes_latex_files \
              tests/test_entity_detector.py::test_scan_for_detection_includes_latex_prose -v

Both new tests + the existing test_prose_extensions (extended to assert the new entries) pass. Full env-cleared suite: 3216 passed, 20 skipped, 0 failed. ruff check . and ruff format --check . both clean.

Checklist

  • Tests pass (uv run pytest tests/ --ignore=tests/benchmarks)
  • No hardcoded paths
  • Linter passes (uv run ruff check .)
  • Format check passes (uv run ruff format --check .)

LaTeX source files and BibTeX bibliographies are prose-rich content that
benefits from both palace mining and entity detection. Adds the two
extensions to the two extension lists most relevant to them, each with a
matching test.

- ``mempalace/miner.py:READABLE_EXTENSIONS`` — ``.tex`` / ``.bib`` join the
  mining allowlist (parallel to the Swift/Kotlin PR MemPalace#1368 and the PHP
  ecosystem PR MemPalace#1819).

- ``mempalace/entity_detector.py:PROSE_EXTENSIONS`` — ``.tex`` / ``.bib``
  also join the *preferred* entity-detection bucket alongside ``.md`` /
  ``.rst`` / ``.csv``, NOT the broader code-file fallback. The reason
  ``PROSE_EXTENSIONS`` exists separately is documented in-code:
  programming-language files have lots of capitalized identifiers (class
  names, function names) that produce false-positive person matches.
  LaTeX/BibTeX don't have that problem — they're typesetting languages
  for prose documents. ``.bib`` in particular is almost entirely author
  names, one of the highest real-entity densities of any file type the
  detector scans.

Tests follow the patterns established by the prior extension PRs:
``tests/test_miner.py::test_scan_project_includes_latex_files`` mirrors
the Swift/Kotlin scan tests, and
``tests/test_entity_detector.py::test_scan_for_detection_includes_latex_prose``
mirrors ``test_scan_for_detection_finds_prose``. The existing
``test_prose_extensions`` was extended to assert the two new entries.

Full env-cleared suite: 3216 passed, 20 skipped. ``ruff check .`` and
``ruff format --check .`` both clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KC5Qsknh2zFRtRvVyjXiTA

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for LaTeX (.tex) and BibTeX (.bib) files by classifying them as prose extensions in mempalace/entity_detector.py and mempalace/miner.py, along with corresponding test coverage. The review feedback highlights an inconsistency where these new extensions were not added to READABLE_EXTENSIONS in mempalace/entity_detector.py, despite being added to the equivalent list in mempalace/miner.py.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread mempalace/entity_detector.py
@igorls
igorls merged commit e84221c into MemPalace:develop Jun 30, 2026
8 checks passed
@igorls igorls mentioned this pull request Jul 14, 2026
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.

2 participants