Skip to content

medcat.components.linking.only_primary_name_linker

Classes:

Attributes:

logger module-attribute

logger = getLogger(__name__)

NoTrainingException

Bases: ValueError

PrimNameLinker

PrimNameLinker(cdb: CDB, vocab: Vocab, config: Config)

Bases: Linker

Linker that only links primary names (or other 1-1 matches).

This linker avoids the hard part of linking - the disambiguation. This should allow it to work faster, but (generally) at the expense of performance.

Methods:

Attributes:

Source code in medcat-v2/medcat/components/linking/only_primary_name_linker.py
26
27
28
29
def __init__(self, cdb: CDB, vocab: Vocab, config: Config) -> None:
    super().__init__(cdb, vocab, config)
    # don't need / use the context model
    del self.context_model

name class-attribute instance-attribute

name = 'primary_name_only_linker'

train

train(cui: str, entity: MutableEntity, doc: MutableDocument, negative: bool = False, names: Union[list[str], dict] = [], per_doc_valid_token_cache: Optional[PerDocumentTokenCache] = None) -> None
Source code in medcat-v2/medcat/components/linking/only_primary_name_linker.py
78
79
80
81
82
83
84
85
def train(self, cui: str,
          entity: MutableEntity,
          doc: MutableDocument,
          negative: bool = False,
          names: Union[list[str], dict] = [],
          per_doc_valid_token_cache: Optional[PerDocumentTokenCache] = None
          ) -> None:
    raise NoTrainingException("Training is not supported for this linker")