o
    noi
                     @   s   d dl mZ 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)HUNDREDS_DICT)NUMBER_SCALE_DICT)VARIATIONS_DICT)combine
number_strindexprevreturnc                    sF  g }g }t | dkrQ| drQ|t| d  d  | dd }| dd d} | rP|dv r1dnd | t| g d   | fd	d
t| g D  nMt | dk r|dkr|r| d dv rednd|t| g d   |fdd
t| g D  n|t| g d  |dd
 t| g 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.
       0r   N   )67u   ꯀ u   ꯒ c                 3   s    | ]} | V  qd S N .0	variation)prefix_charr   Q/home/ubuntu/.local/lib/python3.10/site-packages/indic_numtowords/mni/cardinal.py	<genexpr>       z"convert_to_text.<locals>.<genexpr>u    ꯀu    ꯒc                 3   s    | ]}|  V  qd S r   r   r   )suffixr   r   r   %   r   c                 s   s    | ]}|V  qd S r   r   r   r   r   r   r   (   s    )	lenlstripappendr   r   getextendr   r   )r   r   r	   hundredsonesprefixr   )r   r   r   convert_to_text   s&   
 "
r#   texts
number_lenc                 C   s   t | tr
t |tstd| dv r|S |rdnd}|dkr+| dkr+tt| |||S |dkr8t| d||nttt| t| d||}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000TFr   r   )
isinstancestrint
ValueErrorr   r#   r   r   )r   r$   r   r%   r	   converted_textr   r   r   process_text,   s   :
r-   N)indic_numtowords.mni.data.numsr   r   r   r   indic_numtowords.mni.utilsr   r)   r*   boollistr#   r-   r   r   r   r   <module>   s    *%