Skip to content

analyze() takes a datum (#1) - #48

Merged
ddehilster merged 3 commits into
VisualText:mainfrom
ddehilster:feat/analyze-datum
Oct 27, 2026
Merged

ddehilster merged 3 commits into
VisualText:mainfrom
ddehilster:feat/analyze-datum

Conversation

@ddehilster

Copy link
Copy Markdown
Member

Closes #1. NLPPlus.analyze(text, analyzer, datum="json") now passes the string to the analyzer as G("$datum") for that one call, for example to choose an output format.

The engine has had NLP_ENGINE::setDatum() (and nlp -DATUM) for a while, but the binding never called it, so G("$datum") was always 0 from Python.

  • bindings.cpp: wrap_analyze takes datum (default "") and calls engine.setDatum() before every analysis, so a value never carries over to the next call.
  • Engine.analyze() and the module-level analyze() take datum: Optional[str] = None.
  • Test: tests/analyzers/datum echoes G("$datum"), or none when it is unset. DatumTest checks json, then xml, then no datum.

This overlaps #47 (timeout), which also adds an argument to wrap_analyze and to both analyze() signatures. Whichever merges second needs a small rebase. Both arguments are keyword-style with defaults, so they don't otherwise interact.

Not built locally; CI builds the wheel and runs the tests.

🤖 Generated with Claude Code

ddehilster and others added 3 commits October 27, 2026 09:59
analyze(text, analyzer, datum="json") hands the string to the analyzer
as G("$datum") for that call, eg the output format the caller wants.
The engine has had NLP_ENGINE::setDatum (and nlp -DATUM) since 4.2.x;
the binding never called it, so G("$datum") was always 0 from Python.
Each call sets its own datum: None (the default) clears it.

tests/analyzers/datum echoes G("$datum") to the output buffer.

Closes #1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
package-analyzers a53e9e2 and the zone rework now split "kenethfpp at
mails dot yahoo dot uk" into subdomain/domainname/cd and keep the local
part of "charitysc123 at 243 dot org". The stored output predated both,
so test_emailaddress_parser failed on every PR (also VisualText#47). Regenerated
with nlp 4.2.48 and the pinned package-analyzers commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ddehilster
ddehilster merged commit fa8c459 into VisualText:main Oct 27, 2026
8 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 output type to NLP Engine call

1 participant