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   U/home/ubuntu/.local/lib/python3.10/site-packages/lm_eval/tasks/afrobench/sib/utils.py__init__   s   
zFunctionTag.__init__N)__name__
__module____qualname__r   r   r   r   r   r      s    r   c                 C   s0   dd| dd| ddd| dd	}||  S )
NzGiven the categories science/technology, travel, politics, sports, health, entertainment, or geography; what category does the text: '{{text}}' belong to: 

z
Does this z topic; '{{text}}' belong to one of the following categories: science/technology, travel, politics, sports, health, entertainment, or geography? category only

zYou are an assistant able to classify topics in texts. 

Given the categories science/technology, travel, politics, sports, health, entertainment, or geography; what is the topic of the zI statement below? Return only the category. 

text: {{text}} \category:

zLabel the following text as science/technology, travel, politics, sports, health, entertainment, or geography. Provide only the category as your response. 

text: {{text}} \category: 

zEYou are tasked with performing topic classification on the following a   text. For each input, classify the topic as science/technology, travel, politics, sports, health, entertainment, or geography. Use the following guidelines: 

 science/technology: The text discusses scientific discoveries, technological advancements, or related topics. 
travel: The text describes travel experiences, destinations, or related topics. 
politics: The text covers political events, policies, or related topics. 
sports: The text talks about sports events, athletes, or related topics. 
health: The text addresses health issues, medical advancements, or related topics. 
entertainment: The text pertains to movies, music, celebrities, or related topics. 
geography: The text involves geographical information, locations, or related topics. 

If the text contains multiple topics, choose the dominant topic. For ambiguous or unclear topics, select the category that best reflects the overall content. Please provide a single classification for each input.

text: {{text}} \category: 

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 }i ddddddddd	d
dddddddddddddddddddddd d!d"i d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDi dEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdl}i ddmddnddoddpd	dqddrddsddtdduddvddwddxddyddzdd{dd|d!d}i d#d~d%dd'dd)dd+dd-dd/dd1dd3dd5dd7dd9dd;dd=dd?ddAddCdi dEddGddIddKddMddOddQddSddUddWddYdd[dd]dd_ddaddcddedddddddl}|  D ]s}zad| d}d| d| }d}	|	||| t||| d}
tj| |}tj|dd t|  d| d| |rdnddd}|d tj	|
|dd W d   n	1 sw   Y  W qT t
y   || Y qTw t|dkrt
dd| dS )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.
    aebzTunisian Arabicafr	AfrikaansakaAkanamhAmharicaryzMoroccan ArabicarzzEgyptian ArabicbamBambarabemBembacjkChokwedikzSouthwestern DinkadyuDyulaengEnglisheweEwefonFonfraFrenchfuvzNigerian FulfuldegazzWest Central OromohauHausaiboIgbokabKabylekamKambakmbKimbundukbpKabiyekeaKabuverdianukikKikuyukinKinyarwandakonKikongoknczCentral Kanuriluaz
Luba-KasailugLugandaluoLuolinLingalamosMossinusNuernsozNorthern SothonyaNyangapltzPlateau Malagasypor
PortugueserunRundisagSangosnaShonasomSomalisotzSouthern SothosswSwaziswaSwahilitaqTamasheqtirTigrinyatumTumbukatsoTsongatwiTwitzm	TamazightUmbunduWolofXhosaYorubaZulu)umbwolxhoyorzulaeb_Arabafr_Latnaka_Latnamh_Ethiary_Arabarz_Arabbam_Latnbem_Latncjk_Latndik_Latndyu_Latneng_Latnewe_Latnfon_Latnfra_Latnfuv_Latngaz_Latnhau_Latnibo_Latnkab_Latnkam_Latnkmb_Latnkbp_Latnkea_Latnkik_Latnkin_Latnkon_Latnknc_Latnlua_Latnlug_Latnluo_Latnlin_Latnmos_Latnnus_Latnnso_Latnnya_Latnplt_Latnpor_Latnrun_Latnsag_Latnsna_Latnsom_Latnsot_Latnssw_Latnswh_Latntaq_Latntir_Ethitum_Latntso_Latntwi_Latntzm_Tfngumb_Latnwol_Latnxho_Latnyor_Latnzul_Latnsib_z.yaml_sib)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	languageslang_2_dataset_lang_coder   	file_name	task_nameyaml_templateyaml_details	file_pathfr   r   r   gen_lang_yamls(   s  	
 !"#$%&'()*+,-./01234;	
 !"#$%&'()*+,-./01234;
r   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_argsr   r   r   r   )parserargsr   r   r   main   s(   r   __main__)r   N)
r   r   r   r   r   strboolr   r   r   r   r   r   r   <module>   s     
"
