### Quick Start Document Parser with ApplicationFactory Source: https://context7.com/plandes/mednlp/llms.txt Use ApplicationFactory to quickly get a pre-configured document parser for clinical text. Access token features like POS, NER tags, and UMLS CUIs. ```python from zensols.nlp import FeatureDocument, FeatureDocumentParser from zensols.mednlp import ApplicationFactory # Get the pre-configured document parser doc_parser: FeatureDocumentParser = ApplicationFactory.get_doc_parser() # Parse medical text doc: FeatureDocument = doc_parser('John was diagnosed with kidney failure') # Access token features including medical concepts for tok in doc.tokens: print(f"Token: {tok.norm}") print(f" POS: {tok.pos_}, Tag: {tok.tag_}") print(f" CUI: {tok.cui_}") print(f" Detected Name: {tok.detected_name_}") print(f" Is Concept: {tok.is_concept}") # Output: # Token: John # POS: PROPN, Tag: NNP # CUI: -- # Detected Name: -- # Is Concept: False # Token: kidney # POS: NOUN, Tag: NN # CUI: C0035078 # Detected Name: kidney~failure # Is Concept: True # Access named entities print(doc.entities) # (, ) ``` -------------------------------- ### INI Configuration Setup Source: https://context7.com/plandes/mednlp/llms.txt Configures the parser and application resources using the Zensols framework INI format. ```ini # features.conf - Basic medical parsing configuration [import] sections = list: imp_conf [imp_conf] type = importini config_files = list: resource(zensols.nlp): resources/obj.conf, resource(zensols.nlp): resources/mapper.conf, resource(zensols.mednlp): resources/lang.conf # Configure token features to extract [mednlp_doc_parser] token_feature_ids = set: norm, pos_, tag_, is_ent, cui, cui_, pref_name_, detected_name_, is_concept, ent_, ent, tuis_ # Application configuration [app] class_name = myapp.Application doc_parser = instance: mednlp_doc_parser ``` -------------------------------- ### Install mednlp via pip Source: https://github.com/plandes/mednlp/blob/master/README.md Use this command to install the library in your Python environment. ```bash pip3 install zensols.mednlp ``` -------------------------------- ### Token Attributes Output Example Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Example output showing detailed attributes for a token, including its normalized form, CUI, and entity type. This demonstrates the rich information extracted by the mednlp parser. ```text ... diagnosed cui=11900 cui_=C0011900 detected_name_=diagnosed ent=13188083023294932426 ent_=concept i=2 i_sent=2 idx=7 is_concept=True is_ent=True norm=diagnosed pref_name_=Diagnosis ... ``` -------------------------------- ### Configure Apache cTAKES path Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Define the installation directory and source cache for Apache cTAKES in the configuration file. ```ini [ctakes] home = ${env:home}/opt/app/ctakes-4.0.0.1 source_dir = ${default:cache_dir}/ctakes/source ``` -------------------------------- ### Get UMLS Concept Relationships with UTSClient Source: https://context7.com/plandes/mednlp/llms.txt Retrieve relationships between a given UMLS CUI and other concepts using the UTSClient. This includes relation labels and related concept IDs. Requires an initialized UTSClient. ```python from typing import Dict, List from zensols.mednlp import UTSClient # Initialize client with your NIH API key uts_client = UTSClient(api_key='your-uts-api-key') # Get concept relationships relations = uts_client.get_relations('C0018801') for rel in relations[:3]: print(f"Relation: {rel['relationLabel']}") print(f"Related ID: {rel['relatedId']}") # Get related CUIs directly related_cuis = uts_client.get_related_cuis('C0018801') for cui, relation in related_cuis[:5]: print(f"Related CUI: {cui}, Type: {relation['relationLabel']}") ``` -------------------------------- ### CLI Harness Entry Point Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Sets up and runs the Command Line Interface (CLI) harness for the application. It configures the application context and resource paths. ```python if (__name__ == '__main__'): CliHarness( app_config_resource='uts.conf', app_config_context=ProgramNameConfigurator( None, default='uts').create_section(), proto_args='', ).run() ``` -------------------------------- ### Configure Import Sections Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Imports necessary Zensols NLP and mednlp packages. Ensure the UTS key file is correctly configured if using UMLS services. ```ini [import] sections = list: imp_conf [imp_conf] type = importini config_files = list: resource(zensols.nlp): resources/obj.conf, resource(zensols.nlp): resources/mapper.conf, resource(zensols.mednlp): resources/lang.conf ``` -------------------------------- ### Configure Cache Directories Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Defines root and cache directories for storing fetched UMLS data. Ensure the root directory is set correctly relative to the application's execution context. ```ini [default] # root directory given by the application, which is the parent directory root_dir = ${appenv:root_dir}/.. # the directory to hold the cached UMLS data cache_dir = ${root_dir}/cache ``` -------------------------------- ### Configure cui2vec Imports Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Imports necessary configuration files for cui2vec and UTS. ```ini [imp_conf] type = importini config_files = list: resource(zensols.mednlp): resources/uts.conf, resource(zensols.mednlp): resources/cui2vec.conf ``` -------------------------------- ### Configure UTS client settings Source: https://context7.com/plandes/mednlp/llms.txt Defines the import structure, directory paths, and cache configuration for the UTS client. ```ini # uts.conf - UTS client configuration [import] references = list: uts, default sections = list: imp_uts_key, imp_conf [default] root_dir = ${appenv:root_dir}/.. cache_dir = ${root_dir}/cache [imp_conf] type = importini config_file = resource(zensols.mednlp): resources/uts.conf # UTS API key from JSON file [imp_uts_key] type = json default_section = uts config_file = ${default:root_dir}/uts-key.json # Cache UTS requests [uts] cache_file = ${default:cache_dir}/uts-request.dat ``` -------------------------------- ### Download CUI Embeddings Source: https://github.com/plandes/mednlp/blob/master/README.md Manually download and prepare the cui2vec embeddings required for advanced feature extraction. ```bash mkdir -p ~/.cache/zensols/mednlp wget -O ~/.cache/zensols/mednlp/cui2vec.zip https://figshare.com/ndownloader/files/10959626?private_link=00d69861786cd0156d81 ``` -------------------------------- ### Configure cTAKES Integration Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Sets up the configuration for cTAKES, including environment variables and resource imports. ```ini [import] # refer to sections for which we need substitution in this file references = list: default, ctakes, uts sections = list: imp_env, imp_uts_key, imp_conf # expose the user HOME environment variable [imp_env] type = environment section_name = env includes = set: HOME # import the Zensols NLP UTS resource library [imp_conf] type = importini config_files = list: resource(zensols.mednlp): resources/uts.conf, resource(zensols.mednlp): resources/ctakes.conf ``` -------------------------------- ### Import UMLS Resources and Configure UTS Key Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Imports necessary UMLS resources and configures the UTS key. The `imp_uts_key` section points to a JSON file containing your NIH-provided UTS key. ```ini [import] references = list: uts, default sections = list: imp_uts_key, imp_conf [imp_conf] type = importini config_file = resource(zensols.mednlp): resources/uts.conf [imp_uts_key] type = json default_section = uts config_file = ${default:root_dir}/uts-key.json ``` -------------------------------- ### Declare Application Class Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Declares the main application class for the CLI glue code. It specifies the class name and injects the configured document parser. ```ini [app] class_name = ${program:name}.Application doc_parser = instance: mednlp_doc_parser ``` -------------------------------- ### Cite the Project Source: https://github.com/plandes/mednlp/blob/master/README.md Use this BibTeX entry to cite the library in academic research. ```bibtex @inproceedings{landes-etal-2023-deepzensols, title = "{D}eep{Z}ensols: A Deep Learning Natural Language Processing Framework for Experimentation and Reproducibility", author = "Landes, Paul and Di Eugenio, Barbara and Caragea, Cornelia", editor = "Tan, Liling and Milajevs, Dmitrijs and Chauhan, Geeticka and Gwinnup, Jeremy and Rippeth, Elijah", booktitle = "Proceedings of the 3rd Workshop for Natural Language Processing Open Source Software (NLP-OSS 2023)", month = dec, year = "2023", address = "Singapore, Singapore", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2023.nlposs-1.16", pages = "141--146" } ``` -------------------------------- ### Copy UMLS Key Template Source: https://github.com/plandes/mednlp/blob/master/example/README.md Copy the UTS template to a new key file. This is a prerequisite for accessing UMLS data. ```bash cp uts-key-template.json uts-key.json ``` -------------------------------- ### Compute and Output Similarities Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Searches for a term and prints similar concepts using gensim. ```python res: List[Dict[str, str]] = self.uts_client.search_term(term) cui: str = res[0]['ui'] sims_by_word: List[Tuple[str, float]] = kv.similar_by_word(cui, topn) for rel_cui, proba in sims_by_word: rel_atom: Dict[str, str] = self.uts_client.get_atoms(rel_cui) rel_name = rel_atom.get('name', 'Unknown') print(f'{rel_name} ({rel_cui}): {proba * 100:.2f}%') ``` -------------------------------- ### Configure MedCAT Model Path Source: https://github.com/plandes/mednlp/blob/master/README.md Specify the location of the downloaded UMLS MedCAT model in the configuration file. ```ini [medcat_status_resource] url = file:///location/to/the/downloaded/file/umls_sm_wstatus_2021_oct.zip' ``` -------------------------------- ### Retrieve UMLS Concept Atoms with UTSClient Source: https://context7.com/plandes/mednlp/llms.txt Fetch atoms (names and synonyms) for a given UMLS CUI using the UTSClient. Supports retrieving only the preferred name or all associated atoms. Requires an initialized UTSClient. ```python from typing import Dict, List from zensols.mednlp import UTSClient # Initialize client with your NIH API key uts_client = UTSClient(api_key='your-uts-api-key') # Get atoms (names/synonyms) for a concept atoms = uts_client.get_atoms('C0018801', preferred=True) print(f"Preferred name: {atoms['name']}") print(f"Root source: {atoms['rootSource']}") # Get all atoms (not just preferred) all_atoms = uts_client.get_atoms('C0018801', preferred=False) for atom in all_atoms[:5]: print(f" {atom['name']} ({atom['rootSource']})") ``` -------------------------------- ### Command Line Interface Usage Source: https://context7.com/plandes/mednlp/llms.txt Executes common medical NLP tasks directly from the terminal. ```bash # Install the library pip install zensols.mednlp # Parse medical text and show features mednlp show "Patient was diagnosed with acute kidney failure" # Show only medical entities mednlp show "Patient was diagnosed with acute kidney failure" --only_medical # Export features to CSV mednlp features "Patient has diabetes and hypertension" --out features.csv # Search UMLS terms mednlp search "lung cancer" # Get atom information for a CUI mednlp atom C0242379 # Look up entity definition mednlp define C0242379 # Get TUI group information mednlp group csv # Export TUI groups to CSV mednlp group byname --query "Disease,Disorder" # Filter by name # Find similar concepts (requires cui2vec) mednlp similarity "heart disease" # Process with cTAKES (requires cTAKES installation) mednlp ctakes "Patient has chronic obstructive pulmonary disease" ``` -------------------------------- ### Configure and Use MedCAT Model Source: https://context7.com/plandes/mednlp/llms.txt Accesses the MedCAT model for entity extraction and TUI mapping. Requires configuration via a factory or features.conf file. ```python from zensols.mednlp import MedCatResource from medcat.cat import CAT # Access through configured resource (typically via config factory) # Configuration example in features.conf: # [medcat_resource] # class_name = zensols.mednlp.MedCatResource # installer = instance: medcat_installer # vocab_resource = instance: medcat_vocab_resource # cdb_resource = instance: medcat_cdb_resource # mc_status_resource = instance: medcat_status_resource # umls_tuis = path: ${default:resources}/metamap/umls-tuis.txt # umls_groups = path: ${default:resources}/metamap/umls-groups.txt # filter_tuis = set: T047, T048 # Filter to diseases and mental disorders # Get the MedCAT instance cat: CAT = medcat_resource.cat # Get entities from text directly entities = cat.get_entities("Patient has diabetes and hypertension") print(entities) # Access TUI mappings (type identifiers to descriptions) tuis = medcat_resource.tuis print(tuis['T047']) # 'Disease or Syndrome' print(tuis['T184']) # 'Sign or Symptom' # Access TUI groups as DataFrame groups_df = medcat_resource.groups print(groups_df[groups_df['name'].str.contains('Disorder')]) # Columns: abbrev, name, tui, desc ``` -------------------------------- ### Configure UTS Cache Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Defines the cache file location for UTS requests. ```ini [uts] cache_file = ${default:cache_dir}/uts-request.dat ``` -------------------------------- ### Search UMLS Terms with UTSClient Source: https://context7.com/plandes/mednlp/llms.txt Interface with the NIH UMLS Terminology Services RESTful API to search for medical terms. Requires an NIH API key for initialization. Results include term names, CUIs, and source information. ```python from typing import Dict, List from zensols.mednlp import UTSClient # Initialize client with your NIH API key uts_client = UTSClient(api_key='your-uts-api-key') # Search for a medical term results: List[Dict[str, str]] = uts_client.search_term('heart failure') for term in results[:3]: print(f"Name: {term['name']}") print(f"CUI: {term['ui']}") print(f"Source: {term['rootSource']}") print(f"URI: {term['uri']}") print() ``` -------------------------------- ### Application Class for NLP Parsing Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Python class that utilizes the FeatureDocumentParser to process text and display token attributes. It processes a default sentence if none is provided. ```python @dataclass class Application(object): doc_parser: FeatureDocumentParser = field() def show(self, sent: str = None): if sent is None: sent = 'He was diagnosed with kidney failure in the United States.' doc: FeatureDocument = self.doc_parser(sent) print('first three tokens:') for tok in it.islice(doc.token_iter(), 3): print(tok.norm) tok.write_attributes(1, include_type=False) ``` -------------------------------- ### Define Similarity Method Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Defines the similarity method for the application class. ```python @dataclass class Application(object): def similarity(self, term: str = 'heart disease', topn: int = 5): ``` -------------------------------- ### Lookup Term and Atoms via UTS Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Searches for a medical term and retrieves its atoms using the UTS client. ```python @dataclass class Application(object): ... def lookup(self, term: str = 'heart'): # terms are returned as a list of pages with dictionaries of data pages: List[Dict[str, str]] = self.uts_client.search_term(term) # get all term dictionaries from the first page terms: Dict[str, str] = pages[0] # get the concept unique identifier cui: str = terms['ui'] # print atoms of this concept print('atoms:') pprint(self.uts_client.get_atoms(cui)) ``` -------------------------------- ### Parse Medical Text and Extract Entities Source: https://github.com/plandes/mednlp/blob/master/README.md Initialize the document parser to process clinical text and extract tokens with their associated UMLS CUIs. ```python >>> from zensols.mednlp import ApplicationFactory >>> doc_parser = ApplicationFactory.get_doc_parser() >>> doc = doc_parser('John was diagnosed with kidney failure') >>> for tok in doc.tokens: print(tok.norm, tok.pos_, tok.tag_, tok.cui_, tok.detected_name_) John PROPN NNP -- -- was AUX VBD -- -- diagnosed VERB VBN -- -- with ADP IN -- -- kidney NOUN NN C0035078 kidney~failure failure NOUN NN C0035078 kidney~failure >>> print(doc.entities) (, ) ``` -------------------------------- ### Define NIH API key in JSON Source: https://context7.com/plandes/mednlp/llms.txt Stores the NIH UTS API key required for authentication. ```json // uts-key.json - Store your NIH API key { "api_key": "your-nih-uts-api-key-here" } ``` -------------------------------- ### Access Medical Library API Source: https://context7.com/plandes/mednlp/llms.txt Provides a unified interface for accessing medical knowledge bases, entity linking, and similarity models. ```python from typing import Dict, List, Any from zensols.mednlp import MedicalLibrary # Access through config factory (typical usage) library: MedicalLibrary = config_factory('medical_library') # Get entities directly from MedCAT entities: Dict[str, Any] = library.get_entities("Patient has pneumonia") print(entities) # Get UMLS atom information atom: Dict[str, str] = library.get_atom('C0032285') print(f"Concept: {atom['name']}") # Get concept relations relations: List[Dict[str, Any]] = library.get_relations('C0032285') for rel in relations[:3]: print(f" {rel['relationLabel']}: {rel['relatedId']}") # Get linked entity with full details from zensols.mednlp.entlink import Entity entity: Entity = library.get_linked_entity('C0032285') if entity: print(f"Name: {entity.name}") print(f"Definition: {entity.definition}") print(f"Aliases: {entity.aliases[:5]}") print(f"TUIs: {entity.tuis}") # Find similar concepts using cui2vec from zensols.mednlp.entlink import EntitySimilarity similarities: List[EntitySimilarity] = library.similarity_by_term('pneumonia', topn=5) for sim in similarities: print(f"{sim.name} ({sim.cui}): {sim.similiarty:.4f}") # Get cui2vec embedding model embedding = library.cui2vec_embedding kv = embedding.keyed_vectors ``` -------------------------------- ### Configure MedNLP Document Parser Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Configures the document parser to include specific medical and linguistic features. This ensures that relevant token attributes like CUI, normalized form, and entity types are retained. ```ini [mednlp_doc_parser] token_feature_ids = set: norm, is_ent, cui, cui_, pref_name_, detected_name_, is_concept, ent_, ent ``` -------------------------------- ### Parse Clinical Text with Apache cTAKES Source: https://context7.com/plandes/mednlp/llms.txt Extracts medical entities from text using cTAKES and returns results as Pandas DataFrames. Requires a configured stash. ```python from pathlib import Path import pandas as pd from zensols.mednlp.ctakes import CTakesParserStash # Configuration example in ctakes.conf: # [ctakes_parser_stash] # class_name = zensols.mednlp.ctakes.CTakesParserStash # entry_point_bin = path: ${ctakes:home}/bin/runClinicalPipeline.sh # entry_point_cmd = ${entry_point_bin} -i ${source_dir} -o ${output_dir} # home = path: /path/to/apache-ctakes-4.0.0.1 # source_dir = path: ${default:cache_dir}/ctakes/source # Set documents to process stash = ctakes_parser_stash # From config factory stash.set_documents([ 'Patient was diagnosed with kidney failure.', 'History of diabetes mellitus type 2.' ]) # Access parsed results by document ID (string index) df: pd.DataFrame = stash['0'] print(df.columns) # ['begin', 'end', 'text', 'cui', 'preferred_text', 'tui', ...] print(df[['text', 'cui', 'preferred_text', 'tui']]) # text cui preferred_text tui # 0 kidney failure C0035078 Kidney Failure T047 # 1 diagnosed C0011900 Diagnosis T033 # Save to CSV df.to_csv(Path('ctakes_output.csv')) # Process multiple documents for doc_id in stash.keys(): doc_df = stash[doc_id] print(f"Document {doc_id}: {len(doc_df)} entities") # Clear processed data stash.clear() ``` -------------------------------- ### Export Features to DataFrame Source: https://context7.com/plandes/mednlp/llms.txt Converts parsed medical documents into Pandas DataFrames for analysis and CSV export. ```python import pandas as pd from zensols.nlp import FeatureDocument from zensols.nlp.dataframe import FeatureDataFrameFactory from zensols.mednlp import ApplicationFactory doc_parser = ApplicationFactory.get_doc_parser() text = 'He was diagnosed with kidney failure in the United States.' doc: FeatureDocument = doc_parser.parse(text) # Define features to extract feature_ids = {'idx', 'i', 'norm', 'pos_', 'tag_', 'is_concept', 'cui_', 'pref_name_', 'detected_name_', 'ent_'} priority_ids = ['idx', 'norm', 'cui_', 'pref_name_'] # Create DataFrame factory df_factory = FeatureDataFrameFactory( token_feature_ids=feature_ids, priority_feature_ids=priority_ids ) # Generate DataFrame df: pd.DataFrame = df_factory(doc) print(df.to_string()) # idx norm cui_ pref_name_ pos_ tag_ is_concept ent_ # 0 0 He -- -- PRON PRP False -- # 1 3 was -- -- AUX VBD False -- # 2 7 diagnosed -- -- VERB VBN False -- # 3 17 with -- -- ADP IN False -- # 4 22 kidney C0035078 Kidney Failure NOUN NN True -- # 5 29 failure C0035078 Kidney Failure NOUN NN True -- # Filter to medical concepts only medical_df = df[df['is_concept'] == True] print(medical_df[['norm', 'cui_', 'pref_name_']]) # Export to CSV df.to_csv('medical_features.csv', index=False) ``` -------------------------------- ### Extract medical entities to Pandas DataFrame Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Use the Application class to process text and retrieve a Pandas DataFrame of medical entities. The element ID used for the Stash access must be a string. ```python @dataclass class Application(object): def entities(self, sent: str = None, output: Path = None): if sent is None: sent = 'He was diagnosed with kidney failure in the United States.' self.ctakes_stash.set_documents([sent]) df: pd.DataFrame = self.ctakes_stash['0'] print(df) if output is not None: df.to_csv(output) print(f'wrote: {output}') ``` -------------------------------- ### Compute Medical Concept Embeddings with Cui2Vec Source: https://context7.com/plandes/mednlp/llms.txt Uses Cui2Vec models to find similar medical concepts and calculate distances. Requires a UTS client for CUI lookups. ```python from typing import List, Tuple, Dict from gensim.models.keyedvectors import KeyedVectors from zensols.mednlp import UTSClient from zensols.mednlp.cui2vec import Cui2VecEmbedModel # Initialize components (typically via config factory) uts_client = UTSClient(api_key='your-uts-api-key') embedding = Cui2VecEmbedModel( dimension=500, vocab_size=109053, path='/path/to/cui2vec' ) # Get KeyedVectors for similarity operations kv: KeyedVectors = embedding.keyed_vectors # Search for a term and get its CUI results = uts_client.search_term('heart disease') cui = results[0]['ui'] # e.g., 'C0018799' # Find similar concepts similar_cuis: List[Tuple[str, float]] = kv.similar_by_word(cui, topn=5) for related_cui, similarity in similar_cuis: atom = uts_client.get_atoms(related_cui, expect=False) name = atom.get('name', 'Unknown') if atom else 'Unknown' print(f"{name} ({related_cui}): {similarity * 100:.2f}%") # Output: # Heart failure (C0018801): 72.03% # Atrial Premature Complexes (C0033036): 71.53% # Chronic myocardial ischemia (C0264694): 69.68% # Calculate distance between two concepts cui_a = 'C0018799' # Heart disease cui_b = 'C0018801' # Heart failure distance = kv.distance(cui_a, cui_b) similarity = kv.similarity(cui_a, cui_b) print(f"Distance: {distance}, Similarity: {similarity}") # Check if CUI exists in vocabulary if cui in kv: vector = kv[cui] # 500-dimensional embedding vector print(f"Vector shape: {vector.shape}") ``` -------------------------------- ### Medical Token Properties with MedicalFeatureToken Source: https://context7.com/plandes/mednlp/llms.txt Examine medical-specific attributes of tokens, including UMLS CUIs, preferred names, TUIs, and context similarity scores. Requires a document parser initialized via ApplicationFactory. ```python from zensols.mednlp import ApplicationFactory doc_parser = ApplicationFactory.get_doc_parser() doc = doc_parser('Patient presents with acute myocardial infarction') for tok in doc.tokens: if tok.is_concept: print(f"Token: {tok.norm}") print(f" CUI (string): {tok.cui_}") # e.g., 'C0155626' print(f" CUI (int): {tok.cui}") # e.g., 155626 print(f" Preferred Name: {tok.pref_name_}") # e.g., 'Acute myocardial infarction' print(f" Detected Name: {tok.detected_name_}") print(f" TUIs: {tok.tuis_}") # e.g., 'T047' print(f" TUI Descriptions: {tok.tui_descs_}") # e.g., 'Disease or Syndrome' print(f" Context Similarity: {tok.context_similarity}") print(f" Alternative Names: {tok.sub_names}") ``` -------------------------------- ### Retrieve KeyedVectors for Similarity Source: https://github.com/plandes/mednlp/blob/master/doc/api-usage.md Accesses the KeyedVectors instance from the cui2vec embedding model. ```python embedding: Cui2VecEmbedModel = self.cui2vec_embedding kv: KeyedVectors = embedding.keyed_vectors ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.