o
    7ti=                     @   s*   d dl Z d dlZdefddZdd ZdS )    Nreturnc                 C   s   | d d d d d S )NQUESTION
AnswerListr   Answer
AnswerText )docr   r   `/home/ubuntu/.local/lib/python3.10/site-packages/lm_eval/tasks/mediqa_qa2019/utils_perplexity.pydoc_to_target   s   r
   c                 C   s`   |\}t tdt| }t t| d}tdt| |   ||f||f||f|dS )Nz\s+zutf-8zperplexity: )word_perplexitybyte_perplexitybits_per_byte
perplexity)lenresplitr
   encodeprintmathexp)r   resultsloglikelihood_words_bytesr   r   r	   process_results	   s   r   )r   r   strr
   r   r   r   r   r	   <module>   s    