o
    6ti                     @   sZ   d dl Z d dlZd dlZdd Zdedededdfdd	Zdd
dZedkr+e  dS dS )    Nc                 C   s   dddddd}||  S )NzP: {{story}}
Q: {{question.strip()}}
A: {{options_A}}
B: {{options_B}}
C: {{options_C}}
D: {{options_D}}
Please choose the correct answer from the options above:zPassage: {{story}}
Question: {{question.strip()}}
1: {{options_A}}
2: {{options_B}}
3: {{options_C}}
4: {{options_D}}
Please select the correct answer from the given choices:zContext: {{story}}
Query: {{question.strip()}}
Option A: {{options_A}}
Option B: {{options_B}}
Option C: {{options_C}}
Option D: {{options_D}}
Please indicate the correct option from the list above:z{{story}}
Based on the above passage, answer the following question:
{{question.strip()}}
Choices:
A) {{options_A}}
B) {{options_B}}
C) {{options_C}}
D) {{options_D}}
Please provide the correct answer from the choices given:zRead the passage: {{story}}
Then answer the question: {{question.strip()}}
Options:
A. {{options_A}}
B. {{options_B}}
C. {{options_C}}
D. {{options_D}}
Please choose the correct option from the above list:prompt_1prompt_2prompt_3prompt_4prompt_5 )modelang
prompt_mapr   r   Y/home/ubuntu/.local/lib/python3.10/site-packages/lm_eval/tasks/afrobench/naijarc/utils.pyprompt_func   s   r   
output_dir	overwriter	   returnc              	   C   s  g }dddd}|  D ]l}z\d| d}d| d| }d}|||t||| d	}	tj| |}
tj|
d
d t|  d| d| |rGdnddd}|d tj	|	|d
d W d   n1 sdw   Y  W q t
yx   || Y qw t|dkrt
dd| dS )z
    Generate a yaml file for each language.

    :param output_dir: The directory to output the files to.
    :param overwrite: Whether to overwrite files if they already exist.
    HausaIgboYoruba)hauiboyornaijarc_z.yaml_naijarc)includetaskdataset_namedoc_to_textT)exist_ok/wxutf8)encodingz# Generated by utils.py
)allow_unicodeNr   zJFiles were not created because they already exist (use --overwrite flag): z, )keysr   ospathjoinmakedirsopenwriteyamldumpFileExistsErrorappendlen)r   r   r	   err	languagesr
   	file_name	task_nameyaml_templateyaml_details	file_pathfr   r   r   gen_lang_yamls   sR   

r9   c                  C   s`   t  } | jddddd | jdddd	 | jd
dg ddd |  }t|j|j|jd dS )z9Parse CLI args and generate language-specific yaml files.z--overwriteT
store_truez%Overwrite files if they already exist)defaultactionhelpz--output-dirz./z Directory to write yaml files to)r;   r=   z--moder   r   zPrompt number)r;   choicesr=   )r   r   r	   N)argparseArgumentParseradd_argument
parse_argsr9   r   r   r	   )parserargsr   r   r   mainC   s(   rE   __main__)r   N)	r?   r&   r,   r   strboolr9   rE   __name__r   r   r   r   <module>   s    
1
