medcat.ner.vocab_based_annotator

I would just ignore this whole class, it’s just a lot of rules that work nicely for CDB once the software is trained the main thing are the context vectors.

Module Contents

Functions

maybe_annotate_name(name, tkns, doc, cdb, config[, label])

Given a name it will check should it be annotated based on config rules. If yes

Attributes

logger

medcat.ner.vocab_based_annotator.logger
medcat.ner.vocab_based_annotator.maybe_annotate_name(name, tkns, doc, cdb, config, label='concept')

Given a name it will check should it be annotated based on config rules. If yes the annotation will be added to the doc._.ents array.

Parameters:
  • name (str) – The name found in the text of the document.

  • tkns (List[spacy.tokens.Token]) – Tokens that belong to this name in the spacy document.

  • doc (Doc) – Spacy document to be annotated with named entities.

  • cdb (CDB) – Concept database.

  • config (Config) – Global config for medcat.

  • label (str) – Label for this name (usually concept if we are using a vocab based approach).

Returns:

Optional[Span] – The Span, if relevant.

Return type:

Optional[spacy.tokens.Span]