Skip to content

fix(enricher): use the right field names of EntityMention#29

Merged
ceberam merged 1 commit into
mainfrom
fix/entity-fields
May 21, 2026
Merged

fix(enricher): use the right field names of EntityMention#29
ceberam merged 1 commit into
mainfrom
fix/entity-fields

Conversation

@ceberam
Copy link
Copy Markdown
Member

@ceberam ceberam commented May 21, 2026

Summary

This PR fixes a bug in _make_entity_mention() where incorrect parameter names were used when creating EntityMention objects, and adds comprehensive regression tests to prevent similar issues.

Changes

Bug Fix

File: docling_agent/agent/enricher.py

  • Fixed EntityMention constructor call to use correct parameter names:
    • originalorig
    • spancharspan

Regression Test

File: tests/test_enricher.py

  • Added test_make_entity_mention() function covering 5 key scenarios:
    1. Basic entity mention creation
    2. Entity with original text and label
    3. Case-insensitive matching
    4. Entity not found in source
    5. Original text precedence in search

Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
@ceberam ceberam requested a review from PeterStaar-IBM May 21, 2026 11:48
@ceberam ceberam self-assigned this May 21, 2026
@ceberam ceberam added the bug Something isn't working label May 21, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 21, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

🟢 Require two reviewer for test updates

Wonderful, this rule succeeded.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 1

@github-actions
Copy link
Copy Markdown
Contributor

DCO Check Passed

Thanks @ceberam, all your commits are properly signed off. 🎉

@ceberam ceberam requested a review from dolfim-ibm May 21, 2026 11:52
@ceberam ceberam merged commit 864445e into main May 21, 2026
11 checks passed
@ceberam ceberam deleted the fix/entity-fields branch May 21, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants