Skip to content

fix(medcat-plugins) transformer model fixes - #678

Open
adam-sutton-1992 wants to merge 2 commits into
mainfrom
transformer_fixes
Open

adam-sutton-1992 wants to merge 2 commits into
mainfrom
transformer_fixes

Conversation

@adam-sutton-1992

Copy link
Copy Markdown
Collaborator

Hihi,

A couple of related fixes that essentially are all for the same purpose - the full transformer components had some issues which we're fixing here:

  • If you don't require link candidates (which the embedding linker can handle) you can loop through all detected token spans and add them as potential candidates. However I didn't realise with the spacy tokenizer in some cases white spaces are tokens. So you could get cases of " ENTITY ". With each space being classed as a token. I put in skips in "transformer ner" for these cases to just skip these.
  • We also get cases with NER to have punctuation only entities detected when link candidates aren't required. So we hold out a check for that to remove those.
  • If you enabled multiple predictions per entity, you create multiple linked entities per ner'd ent. I was doing this via "create_entity", for debugging it was difficult and didn't populate most fields of the MutableEntity. I swapped it to "entity_from_tokens" to make those ents make a bit more sense down the line.

This results in much fewer predictions that are invalid. All good stuff with this minor change.

@mart-r mart-r left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A question regarding the skipping functionality and the potential for using existing stuff.

But if this is a saparate case, then feel free to leave as is.

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