o
    no™i'
  ã                   @   st   d dl mZ d dl mZ d dl mZ d dlmZ dededee fdd	„Z	ded
ee dededee f
dd„Z
dS )é    )ÚDIRECT_DICT)ÚNUMBER_SCALE_DICT)ÚVARIATIONS_DICT)ÚcombineÚ
number_strÚ
number_lenÚreturnc                 C   s  g }g }t | ƒdkrc|  d¡rc| t ¡ v r|dkrt|  S | d dkr0| tdgtd dƒ¡ n| tt| d  td dƒ¡ | d tv rZt| d  D ]}| t|gtd dƒ¡ qK| dd…  d¡} | r}| t 	| g ¡d ¡ | tv r{| t|  ¡nd t||ƒS )	zô
    Convert a number to its text representation.

    Args:
        number_str (str): The number to convert.
        number_len (int): The total length of the number.

    Returns:
        list[str]: The text representation of the number.
    é   Ú0r   Ú6u   à¤¸à¤¯Ú é   N)
ÚlenÚlstripr   ÚkeysÚextendr   r   r   ÚappendÚget)r   r   ÚhundredsÚonesÚ	variation© r   úQ/home/ubuntu/.local/lib/python3.10/site-packages/indic_numtowords/kok/cardinal.pyÚconvert_to_text   s"   €
r   ÚtextsÚindexc                 C   sš   t | tƒr
t |tƒstdƒ‚| dv r|S |dkr$| dkr$tt| |ƒ|ƒS |dkr*dnd}|dkr8t|  d¡|ƒntt|  d¡|ƒtt|ƒ |ƒ}t||ƒS )aá  
    Convert a number string to its text representation and append it to a list.

    Args:
        number_str (str): The number string to process.
        texts (list[str]): A list of texts to update with the converted number.
        index (int): The position of the number in the sequence, affecting scaling.
        number_len (int): The total length of the original number.

    Returns:
        list[str]: The updated list with the number's text representation appended.
    zInvalid input type>   Ú00Ú000r   r
   r   ú r   )Ú
isinstanceÚstrÚintÚ
ValueErrorr   r   r   r   )r   r   r   r   ÚsepÚconverted_textr   r   r   Úprocess_text+   s   8
r%   N)Úindic_numtowords.kok.data.numsr   r   r   Úindic_numtowords.kok.utilsr   r    r!   Úlistr   r%   r   r   r   r   Ú<module>   s    *%