o
    6ti                     @   sh   d dl Z d dlZd dlZG dd dZdd Zdededed	dfd
dZdddZe	dkr2e  dS dS )    Nc                   @   s   e Zd Zdd ZdS )FunctionTagc                 C   s
   || _ d S )N)value)selfr    r   Y/home/ubuntu/.local/lib/python3.10/site-packages/lm_eval/tasks/afrobench/adr/gen_utils.py__init__   s   
zFunctionTag.__init__N)__name__
__module____qualname__r   r   r   r   r   r      s    r   c                 C   sB   ddd| dd| d| dd| d| d	| d
d}||  S )NzfPlease restore the missing diacritics in the following sentence: {{text}}. Return output sentence onlyzGiven a sentence without diacritics, add the appropriate diacritics to make it grammatically and semantically correct. 
Sentence: {{text}}. Return output sentence onlyzThis text is in zw. Restore all diacritical marks to their proper places in the following sentence: {{text}}. Return output sentence onlyz9You are a linguist specializing in diacritical marks for z). Add the appropriate diacritics to this z0 sentence: {{text}}. Return output sentence onlyzC. Diacritics are essential for proper pronunciation and meaning in z!. You are tasked with converting z{ sentences  without diacritics into their correctly accented forms. Here's the input: {{text}}. Return output sentence onlyprompt_1prompt_2prompt_3prompt_4prompt_5r   )modelang
prompt_mapr   r   r   prompt_func   s   
r   
output_dir	overwriter   returnc              	   C   s  g }dddddd}|  D ]j}zZd| d}d| d	| }d
}|||t||| d}	tj|  d| 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.
    FonGbomalaIgboWolofYoruba)fonbbjibowolyorafridiacritics_z.yaml_afridiacritics_yaml)includetaskdataset_namedoc_to_text/T)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makedirsopenwriteyamldumpFileExistsErrorappendlenjoin)r   r   r   err	languagesr   	file_name	task_nameyaml_templateyaml_detailsfr   r   r   gen_lang_yamls   sT   

rB   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)rD   rF   z--moder   r   zPrompt number)rD   choicesrF   )r   r   r   N)argparseArgumentParseradd_argument
parse_argsrB   r   r   r   )parserargsr   r   r   mainO   s(   rN   __main__)r   N)
rH   r1   r5   r   r   strboolrB   rN   r   r   r   r   r   <module>   s    
1
