Skip to content

-DICTSOURCE: nodes record the .dict file and line that built them (#432 #475) (4.2.33) - #789

Merged
ddehilster merged 2 commits into
masterfrom
feature/dict-source-432
Oct 15, 2026
Merged

ddehilster merged 2 commits into
masterfrom
feature/dict-source-432

Conversation

@ddehilster

Copy link
Copy Markdown
Member

Stacked on #788. This branch contains #788's commit; merge #788 first and this diff shrinks to its own commit.

Closes #432 and gives #475 the engine side it needs. The design follows the review choice: an opt-in flag that records dictfile and dictline.

  • nlp ... -DICTSOURCE: while .dict files load, each entry gets dictfile (file name) and dictline attributes. They travel onto the nodes dicttok builds the same way as any other dictionary attribute.
  • A token made by join=1 or split= gets that entry's source, unless the word it spells has its own entry.
  • A word on several lines keeps its first. Lazily loaded *full.dict entries get only dictfile, because there's no line number.
  • Off by default. Without the flag nothing is recorded: no memory cost and no tree change. The Full English Test and the 20-analyzer comparison are unchanged.
  • The flag is set through a static (NLP_ENGINE::setDictSource → CG::setDictSource), so NLP_ENGINE::init, the Python binding and class layouts are untouched. The Python binding can call the setter later if it wants the feature.
  • README now lists -STDIN (missing until now) and -DICTSOURCE.

Example: _bridge [...] ("type" "location") ("kind" "raised") ("dictfile" "words.dict") ("dictline" 14), where the entry's own line wins over the shared _bridge line.

For #475 (VSCode): the extension can pass -DICTSOURCE on debug runs and read dictfile/dictline from final.tree to jump to or highlight the entry. That part is extension work and isn't in this PR.

Tests:

  • New fixture tests/dict-source, reusing the dict-shape dictionary. Its CI step runs it twice: without the flag (nothing printed) and with it (14 nodes with the right file:line, including join/split tokens).
  • Local: 47/48 CI steps pass. The compiled-bridge step needs $GITHUB_WORKSPACE and always fails locally.
  • Full English Test: unchanged.
  • 20 analyzers × 21 inputs: 0 differences.

Docs: VisualText/visualtext-files PR follows. Batched: don't tag yet.

🤖 Generated with Claude Code

ddehilster and others added 2 commits October 14, 2026 23:24
…he sequence (#323) (4.2.32)

Stage 2 of #323.
- copy_file: std::filesystem::copy_file, byte for byte, instead of a
  character loop through text-mode streams.
- resolve_file (KB "take" paths): one std::filesystem version for every
  platform in place of the Windows and Unix copies; the caller now checks
  the joined path fits its buffer (an unbounded sprintf could overflow it).
- Ana::writeSeqfile copied tmp.seq to the sequence file while still open
  for writing, so its last unflushed lines could be lost; close it first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#475) (4.2.33)

With -DICTSOURCE, each .dict entry gets dictfile and dictline attributes
when it is read, so the nodes dicttok builds from it carry them. Tokens
made by join= or split= get that entry's source unless their own word has
an entry. Off by default: no memory or tree change otherwise. Set through
a static (CG::setDictSource / NLP_ENGINE::setDictSource), so no API or
class layout changes. README now lists -STDIN and -DICTSOURCE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ddehilster
ddehilster merged commit e60dd96 into master Oct 15, 2026
7 checks passed
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.

Add reference to matching dictionary entry that reduced

1 participant