Repository navigation
@PRE conditions can be written on the rule element (#438) (4.2.26) - #782
Merged
Merged
Conversation
A @pre action can now be a key on the element it applies to, so its <n,n> range no longer has to be kept in step with element positions: _np <- _det _xWILD [plus match=(_noun _adj) vareq=("pos" "noun") varz="num"] @@ is the same as @pre <2,2> vareq("pos", "noun"); <2,2> varz("num"); Ielt::intern turns such a key (any action Pat::preAction knows) into an Ipre covering just this element, beside the ones its @pre region gives it, so matching, wildcards (#449) and compiled analyzers treat it exactly as @pre. Numeric-string values become numbers for numrange/length/lengthr, as they are from a @pre region; the compiled form needs it. None of these names was an element key before (4.2.25 reports "Unknown element key"). 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.
Closes #438 (option A, as decided; the comparison syntax
pos="noun"can follow later as sugar).A
@PREaction can now be a key on the element it applies to, so its<n,n>range no longer has to be kept in step with element positions. This rule:means exactly the same as:
Supported actions: every action
Pat::preActionknows:varvarzvareqvarnevargtvarltregexpregexpiuppercaselowercasecaplengthlengthrnumrangeunknowndebug.varz="num", several as a listvareq=("pos" "noun"), and an action with no arguments by name alone, as in[cap].How it works.
Ielt::internturns the key into anIprecovering just this element. It sits beside any the rule's@PREregion gives the element, so matching treats both identically, as do wildcards (NLP++: Overly broad @PRE conditions fail #449) and compiled analyzers (genPres).numrange,lengthandlengthr, numeric strings become numbers, as they are when written in a@PREregion; the compiled form needs it.Testing
New fixture
tests/element-pre, with CI steps for Windows and Linux. Each case runs twice, once with@PREand once with element keys, and both must match the same text:vareqon an element, andvarzon a wildcard;uppercase);cap,numrange, andregexp(a glob);@PRE.On 4.2.18 the element-key versions are rejected and fire unconditionally (31 lines instead of 17).
I also built the fixture as a compiled analyzer DLL; its output is identical to the interpreted run.
All Windows CI fixture steps pass locally, apart from the compiled-bridge step, which needs CI's packaged libraries. The
-DEVFull English Test is unchanged, and all 20 analyzers (21 inputs) produce byte-identical output to 4.2.18.Docs: VisualText/visualtext-files (PR linked below).
🤖 Generated with Claude Code