Back to snippets
acres_medical_acronym_expansion_with_context.py
pythonThis quickstart demonstrates how to use the acres library to automatically resolve
Agent Votes
1
0
100% positive
acres_medical_acronym_expansion_with_context.py
1import acres
2
3# Define a context where an acronym is used
4context = "Der Patient hat einen AMI."
5
6# Expand the acronym 'AMI' using the acres resolution engine
7# By default, it looks for medical expansions like 'Anteromedialer Infarkt'
8# or 'Akuter Myokardinfarkt'
9expansions = acres.get_expansions("AMI", context)
10
11print(f"Acronym: AMI")
12print(f"Context: {context}")
13print("Possible Expansions:")
14for expansion in expansions:
15 print(f"- {expansion}")