Skip to content

bug(medcat): CU-869djf7qd Fix trainer detected name preprocessing#527

Merged
mart-r merged 4 commits into
mainfrom
bug/medcat/CU-869djf7qd-fix-trainer-detected-name-preprocessing
Jun 4, 2026
Merged

bug(medcat): CU-869djf7qd Fix trainer detected name preprocessing#527
mart-r merged 4 commits into
mainfrom
bug/medcat/CU-869djf7qd-fix-trainer-detected-name-preprocessing

Conversation

@mart-r
Copy link
Copy Markdown
Collaborator

@mart-r mart-r commented Jun 4, 2026

This PR fixes the preprocessing of names during supervised training.

The issue was that for names which had tokens that would normally need to be skipped (e.g new lines) would not be skipped during the prepare_name call. That's because these skips are annotated in the tagger.
E.g (in an example from Adam) the annotation for:

electrolytes
were monitored

would previously be processed into:

electrolytes~\n~were~monitored

This PR uses the Pipeline.tokenizer_with_tag property instead of just the .tokenizer. The former is a tokenizer that also runs the tagger component.

With this change, the same name is correctly processed to:

electrolytes~were~monitored

There are also a few tests to this effect.

Copy link
Copy Markdown
Contributor

@adam-sutton-1992 adam-sutton-1992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah nice, lucky to find that issue.

@mart-r mart-r merged commit 5563e3b into main Jun 4, 2026
25 of 29 checks passed
@mart-r mart-r deleted the bug/medcat/CU-869djf7qd-fix-trainer-detected-name-preprocessing branch June 4, 2026 09:57
mart-r added a commit that referenced this pull request Jun 4, 2026
* CU-869djf7qd: Fix issue with name preparation during supervised training

* CU-869djf7qd: Add test for prepare_name call with tagger

* CU-869djf7qd: Moved name preparation to its own method in trainer

* CU-869djf7qd: Add more specific / targetted test for name trainer name processor

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

2 participants