Repository navigation
Conversation
Synced with aymara/lima-python's lima.cpp (PhraseMatcher in 0.10.0, compile_rules in aymara/lima-python#53): addResource, addProcessUnit, addPipeline, addEntityType, setRecognizerRules, compileRules and loadRecognizerRules. LimaAnalyzer keeps its public error and errorMessage fields: the private part reports its errors there. LimaAnalyzerTest0: test_compile_rules (no model) and test_rules_entities (compiled rules applied by a pipeline added at runtime). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 54 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This branch has not been deployed
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.
Syncs LIMA's
LimaAnalyzer(lima_linguisticprocessing/src/linguisticProcessing/client/lima.{h,cpp}) with the copy in aymara/lima-python. That copy gained a runtime API with thePhraseMatcher(aymara 0.10.0) and withcompile_rules(aymara/lima-python#53, merged). LIMA's copy had none of it.New
LimaAnalyzermethodsaddResource(media, json),addProcessUnit(media, json),addPipeline(pipeline, media, unit): declare at runtime a resource, a process unit, and a pipeline made of aProcessUnitPipelineunit.addEntityType(group, type): declares a named entity type (and its group).setRecognizerRules(media, recognizer, rulesFile): replaces the rules of anAutomatonRecognizerresource with the compiled ModEx rules of a text file.compileRules(media, rulesFile, binFile): compiles ModEx rules into a.bin, ascompile-rulesdoes. It writes a temporary file and renames it, so a failed compilation leavesbinFileuntouched.loadRecognizerRules(media, recognizer, binFile): loads a.bininto a recognizer, after checking that it was compiled for that media.The private implementations are copied verbatim from lima-python. LIMA's
LimaAnalyzerkeeps its publicerror/errorMessagefields: a newLimaAnalyzerPrivate::reportpasses the errors there. The header documents thatanalyzeTextrefuses to run whileerroris set, so a caller resets it to go on after a failed call (e.g. rules that don't compile).lima-lp-analyzeralready linkedlima-lp-automatonandlima-lp-automatoncompiler, so there's no CMake change.Tests (
LimaAnalyzerTest0)test_compile_rules(no model):addEntityType;.binand leaves no temporary file;loadRecognizerRulesandsetRecognizerRuleson a resource added withaddResource;.bin, an unknown recognizer, a resource that already exists.test_rules_entities(eng-UD_English-MERGEmodel, skipped without it): compiled rules applied by a pipeline built at runtime (micro-categories, recognizer,ApplyRecognizerunit,ProcessUnitPipeline,addPipeline). The entity is in the output of that pipeline and not in the one ofdeepud.Locally (Ninja build,
execEnvenvironment, with the models):ctest -R LimaAnalyzergives 23/23 passed, the two new tests included (not skipped).🤖 Generated with Claude Code