o
    no™i	  ã                   @   sx   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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ÚindexÚ
number_lenÚreturnc                 C   s¾   g }g }t | ƒdkr<|  d¡r<| d t| d  td  ¡¡ | d tv r3| dd„ t| d  D ƒ¡ | dd…  d¡} | rZ| t | g ¡d ¡ | tv rX|dkrX| t|  ¡nd t	||ƒS )	zº
    Convert a number to its text representation.

    Args:
        number_str (str): The number to convert.

    Returns:
        list[str]: The text representation of the number.
    é   Ú0ú r   c                 S   s"   g | ]}d   |td d g¡‘qS )r   r   r   )Újoinr   )Ú.0Ú	variation© r   úQ/home/ubuntu/.local/lib/python3.10/site-packages/indic_numtowords/sat/cardinal.pyÚ
<listcomp>   s   " z#convert_to_text.<locals>.<listcomp>é   N)
ÚlenÚlstripÚappendr   r   r   r   ÚextendÚgetr   )r   r   r   ÚhundredsÚonesr   r   r   Úconvert_to_text   s   

  €
r   Útextsc                 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r2t|  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   )Ú
isinstanceÚstrÚintÚ
ValueErrorr   r   r   r   )r   r   r   r   Úconverted_textr   r   r   Úprocess_text%   s   :
r$   N)Úindic_numtowords.sat.data.numsr   r   r   Úindic_numtowords.sat.utilsr   r    r!   Úlistr   r$   r   r   r   r   Ú<module>   s    *