
    -i                        d Z ddlmZmZmZmZ ddlZ G d de          Ze	dk    rdZ
e
                    d          Z
 ed	          Ze
D ]Ze                                Z ee          Z ed
                    e e ee                     e ee                    g                              d                      eee ee          eek     ee                     eZdS dS )z
Kalima : Arabic word module
    )absolute_importprint_functionunicode_literalsdivisionNc                       e Zd ZdZdZdZdZd dZd Zd Z	d Z
d Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"dS )!Kalimaz%
    Kalima : Arabic word module
     c                     |dk    r*t          j        |          \  | _        | _        || _        dS || _        || _        t          j        ||          | _        dS )z
        Create Kalima object,
        if the marks is given, the word is considered as letters
        else the word is considered as vocalized
        r	   N)arabyseparatelettersmarkswordjoint)selfr   r   s      M/var/www/html/speakWrite/venv/lib/python3.11/site-packages/pyarabic/kalima.py__init__zKalima.__init__#   sU     C<<',~d';';$DL$*DIIIDLDJD%00DIII    c                 :    t          | j        | j        z             S N)hashr   r   r   s    r   __hash__zKalima.__hash__4   s    DL+,,,r   c                 N    d| j         d| j        d                    d          S )N(z, )utf8)r   r   encoder   s    r   __repr__zKalima.__repr__6   s)     !\\\4:::6>>vFFFr   c                 6    | j                             d          S )Nr   )r   r   r   s    r   __str__zKalima.__str__8   s    y'''r   c                     d S r    r   s    r   __del__zKalima.__del__:   s    r   c                 J    | j         |j         k    r| j        |j        k    rdS dS 
        Compare two vocalized words,
        the two words are equal if they have the same letters and marks
        The two words are greater or equals if have the same letters and
        similar full or partial vocalization
        TFr   r   r   others     r   __eq__zKalima.__eq__<   s+     <5=((TZ5;-F-F4ur   c                 J    | j         |j         k    r| j        |j        k    rdS dS r&   r(   r)   s     r   __ne__zKalima.__ne__G   s+     <5=((TZ5;-F-F4ur   c                 r   | j         |j         k    rt          | j                  t          |j                  k    r|t          t          | j                            D ]X}| j        |         |j        |         k    r| j        |         t          j        k    s|j        |         t          j        k    rV dS dS dS )r'   FT)r   lenr   ranger   NOT_DEF_HARAKA)r   r*   is      r   __ge__zKalima.__ge__Q   s     LEM))DJ3u{#3#3333tz??++ ! !:a=EKN22jmu';;;k!n(<<< 554ur   c                     dS )r'   Nr#   r)   s     r   __le__zKalima.__le__d   s      r   c                 *    t          | j                  S )6
        Get the word length without harakat.
        r/   r   r   s    r   __len__zKalima.__len__k   s     4<   r   c                 2    t          | j                  dk    S )r7   r   r8   r   s    r   __nonzero__zKalima.__nonzero__s   s     4<  A%%r   c                 N    |t          | j                  k    r|| j        |<   d S d S r   r8   )r   keyvalues      r   __setitem__zKalima.__setitem__y   s1    #dl#### %DL $#r   c                 P    |t          | j                  k    r| j        |         S d S r   r8   r   r=   s     r   __getitem__zKalima.__getitem__}   s,    #dl####<$$ $#r   c                      | j         ||         S r   r   r   r2   js      r   __getslice__zKalima.__getslice__   s    |AaC  r   c                     || j         ||<   d S r   rD   )r   r2   rF   seqs       r   __setslice__zKalima.__setslice__   s    QqSr   c                 .    | j         ||= | j        ||= d S r   r(   rE   s      r   __delslice__zKalima.__delslice__   s$    L1Jqtr   c                 Z    | xj         |j         z  c_         | xj        |j        z  c_        d S r   r(   r)   s     r   __iadd__zKalima.__iadd__   s*    %

ek!



r   c                 V    t          | j        |j        z   | j        |j        z             S r   )r   r   r   r)   s     r   __add__zKalima.__add__   s+    dlU]2j5;.0 0 	0r   c                     |r	|| _         dS dS )z set lettersNrD   )r   r   s     r   set_letterszKalima.set_letters   s     	#"DLLL	# 	#r   c                     | j         S )z
 get marksr   r   s    r   	get_markszKalima.get_marks   s
    zr   c                     |r	|| _         dS dS )z	set marksNrT   )r   r   s     r   	set_markszKalima.set_marks   s     	DJJJ	 	r   c                     | j         S )z get vocalized)r   r   s    r   get_vocalizedzKalima.get_vocalized   s
    yr   c                     | j         S )z get unvocalizedrD   r   s    r   get_unocalizedzKalima.get_unocalized   s
    |r   c                 P    |t          | j                  k    r| j        |         S dS )z( get the specific letter by index numberNr8   rA   s     r   letterzKalima.letter   s,    #dl####<$$ $#r   c                 P    |t          | j                  k    r| j        |         S dS )z& get the specific mark by index numberN)r/   r   rA   s     r   markzKalima.mark   s)    #dj//!!:c?" "!r   c                 4    t          j        | j                  S )zyChecks if the arabic word  contains shadda.
        @param word: arabic unicode char
        @type word: unicode
        )r   	hasShaddar   r   s    r   
has_shaddazKalima.has_shadda   s    
 ty)))r   c                 4    t          j        | j                  S )zChecks if the arabic word is vocalized.
        the word musn't  have any spaces and pounctuations.
        @param word: arabic unicode char
        @type word: unicode
        )r   isVocalizedr   r   s    r   is_vocalizedzKalima.is_vocalized   s      +++r   c                 4    t          j        | j                  S )aB   Checks for an valid Arabic  word.
        An Arabic word not contains spaces, digits and pounctuation
        avoid some spelling error,  TEH_MARBUTA must be at the end.
        @param word: input word
        @type word: unicode
        @return: True if all charaters are in Arabic block
        @rtype: Boolean
        )r   isArabicwordr   r   s    r   	is_arabiczKalima.is_arabic   s     !$),,,r   N)r	   )#__name__
__module____qualname____doc__r   r   r   r   r   r   r!   r$   r+   r-   r3   r5   r9   r;   r?   rB   rG   rJ   rL   rN   rP   rR   rU   rW   rY   r[   r]   r_   rb   re   rh   r#   r   r   r   r      s         DGE1 1 1 1"- - -G G G( ( (  
 
 
	 	 	  &  ! ! !& & && & &% % %! ! !       " " "0 0 0# # #
    
    % % %
# # #* * *, , ,	- 	- 	- 	- 	-r   r   __main__u   مسلُم
    مسْلمٌ
    مسلّم
    شلامُ
    سِلام
    سَلام
    سكام
    سُكام
    سنام
    سُلَام
    سلامِ
    سلامٌ
    مسلّم
    مسلّم
    سيلم
    سليم
r	   	r   )rl   
__future__r   r   r   r   r   objectr   ri   WORDSsplitPKWORDawordstripkwordprintjoinstrr   r   r/   reprr#   r   r   <module>r|      s  $             t- t- t- t- t-V t- t- t-F zE  KKEVBZZF  uejj%TT%[[!1!133ttE{{3C3CDEELLVTTUUUeVSSZZ&$$u++FFF5 ( r   