Skip to content

edsnlp.pipes.ner.umls.patterns

get_patterns [source]

Load the UMLS terminology patterns.

Parameters

PARAMETER DESCRIPTION
config

Languages and sources to select from the whole terminology. For both keys, None will select all values.

TYPE: dict[list]

Return

patterns : dict[list] The mapping between CUI codes and their synonyms.

Notes

When run for the first time, this method will download the entire UMLS file and store it at ~/.data/bio/umls/2022AA/. Therefore the second run will be significantly faster than the first one.

get_path [source]

Get the path, module and filename of the UMLS file.

Parameters

PARAMETER DESCRIPTION
config

Languages and sources to select from the whole terminology. For both keys, None will select all values.

TYPE: dict[list]

Return

path, module, filename : pathlib.Path, pystow.module, str

Notes

get_path will convert the config dict into a pretty filename.

Examples

config = {"languages": ["FRE", "ENG"], "sources": None} print(get_path(config)) .data/bio/umls/2022AA/languagesFRE-ENG_sourcesNone.pkl"

download_and_agg_umls [source]

Download the UMLS if not exist and create a mapping between CUI code and synonyms.

Parameters

PARAMETER DESCRIPTION
config

Languages and sources to select from the whole terminology. For both keys, None will select all values.

TYPE: dict[list]

Return

patterns : dict[list] The mapping between CUI codes and their synonyms.

Notes

Performs filtering on the returned mapping only, not the downloaded resource.