o
    7t¾iE  ã                   @   sp   d dl Z d dlZdejfdd„Zdejfdd„Zdd„ Zd	efd
d„Zdd„ Zd	efdd„Z	dd„ Z
dd„ ZdS )é    NÚdatasetc                 C   ó   | S ©N© )r   r   r   ú_/home/ubuntu/.local/lib/python3.10/site-packages/lm_eval/tasks/med_text_classification/utils.pyÚprocess_docs_hard   ó   r   c                 C   s4   dd„ }t | ƒ}td| ƒ}|  t|ƒ¡}| |¡S )Nc                 S   r   r   r   ©Údocr   r   r   Ú_helper   r   zprocess_docs.<locals>._helpergš™™™™™¹?)ÚlenÚintÚselectÚrangeÚmap)r   r   Únum_entriesÚten_percent_indexÚfiltered_datasetr   r   r   Úprocess_docs
   s
   
r   c                 C   s   g d¢S )N)Ú	neoplasmszdigestive system diseasesznervous system diseaseszcardiovascular diseaseszgeneral pathological conditionsr   r	   r   r   r   Údoc_to_choice_easy   s   r   Úreturnc              	   C   s8   t | ƒ}d | d |d |d |d |d |d ¡}|S )Nz”Classify the topic of the following medical text into one of the following choices. 
Text: {} 
Choices: 
A. {} 
B. {} 
C. {} 
D. {} 
E. {} 
 Answer:Útextr   é   é   é   é   )r   Úformat©r
   ÚchoicesÚpromptr   r   r   Údoc_to_text_easy!   s   $ÿør!   c                 C   s   t | d ƒd S )NÚclassr   )r   r	   r   r   r   Údoc_to_target_easy3   s   r#   c                 C   s   t | ƒ}d | d |¡}|S )Nz}Select the medical specialty the following text is talking about among the following choices. 
Text: {} 
Choices: {}
 Answer:Útranscription)Údoc_to_choice_hardr   r   r   r   r   Údoc_to_text_hard7   s
   ür&   c                 C   s   g d¢}|S )N)(z Bariatricsz Allergy / Immunologyz
 Dentistryz Cardiovascular / Pulmonaryz Urologyz Hospice - Palliative Carez
 Radiologyz Pediatrics - Neonatalz
 Neurologyz Neurosurgeryz Emergency Room Reportsz IME-QME-Work Comp etc.z Office Notesz Surgeryz Lettersz Ophthalmologyz Hematology - Oncologyz Endocrinologyz Cosmetic / Plastic Surgeryz Diets and Nutritionsz Rheumatologyz Nephrologyz Physical Medicine - Rehabz	 Podiatryz Chiropracticz Lab Medicine - Pathologyz Orthopedicz Autopsyz Psychiatry / Psychologyz Speech - Languagez ENT - Otolaryngologyz Sleep Medicinez Dermatologyz SOAP / Chart / Progress Notesz General Medicinez Consult - History and Phy.z Obstetrics / Gynecologyz Gastroenterologyz Pain Managementz Discharge Summaryr   )r
   Úchoices_listr   r   r   r%   C   s   *r%   c                 C   s   t | ƒ}| d }| |¡}|S )NÚmedical_specialty)r%   Úindex)r
   r   ÚgoldÚidxr   r   r   Údoc_to_target_hardq   s   
r,   )ÚrandomÚdatasetsÚDatasetr   r   r   Ústrr!   r#   r&   r%   r,   r   r   r   r   Ú<module>   s    
.