Repository navigation
KBFuncs and funs: no wrapped strpiece positions - #9
Merged
ddehilster merged 1 commit intoOct 19, 2026
Merged
Conversation
Brings this repo's KBFuncs.nlp copies in step with the canonical
visualText/spec/KBFuncs.nlp fix (VisualText/visualtext-files, same
branch name). The functions were replaced by one script, and only where
a copy held the known old text, so every copy got the same code:
- StripEndDigits: a one-letter name only came back right because
position -1 wraps since engine 4.2.15, and a name with no trailing
digits lost its last letter ("item" -> "ite"). It now counts positions
up from 0.
- SeparateConCount (where present): only the trailing digits count
("a1b2" is "a1b" + "2", not "a1" + "12"); no position arithmetic that
can go negative.
- JsonKBRecurse (where present): an array followed by a plain sibling is
now valid JSON, adjacent arrays with different names stay separate,
and the stray hier.txt debug file is gone. Shapes that were valid JSON
are written byte for byte as before; matches the jsonwrite builtin fix
in VisualText/nlp-engine#796.
funs.nlp: prosifyrec trimmed with strpiece(txt, 0, del - 1) in two
branches without the del > 0 guard its third branch got in 2011; at del 0
the end is -1 and took the whole text instead of none of it. Same fix as
visualText/spec/UtilFuncs.nlp.
Each analyzer was run on its inputs before and after with engine 4.2.36:
output unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This brings this repo's
KBFuncs.nlpcopies in step with the canonical fix in VisualText/visualtext-files#247. Background: since engine 4.2.15 a negativestrpieceposition counts from the end, so a position computed asstrlength(s) - kwraps round whensis short.One script replaced the functions in every copy, and only where a copy held the known old text, so every copy now has the same code:
StripEndDigits:"item"comes back"item", not"ite". A one-letter name no longer depends on -1 wrapping.SeparateConCount(where present): only trailing digits count."a1b2"gives"a1b"and2, not"a1"and12.JsonKBRecurse(where present): an array followed by a plain sibling is now valid JSON, and adjacent arrays with different names stay separate. The strayhier.txtdebug file is gone. Shapes that were already valid JSON are written byte for byte as before. This matches thejsonwritefix in jsonwrite writes valid, separate arrays (4.2.37) nlp-engine#796.This copy only has StripEndDigits. Also in
spec/funs.nlp:prosifyrectrimmed withstrpiece(txt, 0, del - 1)in two branches without thedel > 0guard its third branch got in 2011. Atdel0 the end is -1, which took the whole text instead of none of it. This is the same fix as invisualText/spec/UtilFuncs.nlp.Output unchanged. Every analyzer here was run on its inputs before and after with engine 4.2.36, and all output files were compared. The only difference was the analyzer's own path in
init.log.🤖 Generated with Claude Code