medcat.components.linking.context_based_linker
Classes:
-
Linker–Link to a biomedical database.
Attributes:
-
logger–
Linker
Bases: AbstractEntityProvidingComponent
Link to a biomedical database.
Parameters:
Methods:
-
create_new_component– -
get_type– -
predict_entities– -
train–Train the linker.
Attributes:
-
cdb– -
config– -
context_model– -
name– -
train_counter(dict) – -
vocab–
Source code in medcat-v2/medcat/components/linking/context_based_linker.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
context_model
instance-attribute
context_model = ContextModel(cui2info, name2info, weighted_average_function, vocab, linking, separator)
name
class-attribute
instance-attribute
name = 'medcat2_linker'
create_new_component
classmethod
create_new_component(cnf: ComponentConfig, tokenizer: BaseTokenizer, cdb: CDB, vocab: Vocab, model_load_path: Optional[str]) -> Linker
Source code in medcat-v2/medcat/components/linking/context_based_linker.py
257 258 259 260 261 262 | |
get_type
get_type() -> CoreComponentType
Source code in medcat-v2/medcat/components/linking/context_based_linker.py
50 51 | |
predict_entities
predict_entities(doc: MutableDocument, ents: list[MutableEntity] | None = None) -> list[MutableEntity]
Source code in medcat-v2/medcat/components/linking/context_based_linker.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
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
Train the linker.
This simply trains the context model.
Parameters:
-
(cuistr) –The CUI to train.
-
(entityBaseEntity) –The entity we're at.
-
(docBaseDocument) –The document within which we're working.
-
(negativebool, default:False) –Whether or not the example is negative. Defaults to False.
-
(nameslist[str] / dict, default:[]) –Optionally used to update the
statusof a name-cui pair in the CDB. -
(per_doc_valid_token_cachePerDocumentTokenCache, default:None) –Optionally, provide the per doc valid token cache.
Source code in medcat-v2/medcat/components/linking/context_based_linker.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |