
    -io                         d Z ddlZddlmZ ddlmZmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZ  G d d          Zi i i dZ G d d          ZdS )	z
Verb Class for conjugation
@author: Taha Zerrouki
@contact: taha dot zerrouki at gmail dot com
@copyright: Arabtechies, Arabeyes, Taha Zerrouki
@license: GPL
@date:2009/06/02
@version: 0.9
    N)FATHADAMMAKASRASHADDASUKUNHAMZAALEFNOON	YEH_HAMZAWAWTATWEELMEEMr   YEHTEHALEF_MAKSURAc                   $    e Zd ZdZdZdZdZd ZdS )
ConjugStemz0
    A Class to represent a conjugated stem
     c                 0    || _         || _        || _        dS )a    
        init method
        @param tense: the given tense
        @type tense: unicode.
        @param letters: the word letters
        @type letters: unicode.        
        @param marks: the word marks; 
        @type marks: unicode.        
        N)tenselettersmarks)selfr   r   r   s       Q/var/www/html/speakWrite/venv/lib/python3.11/site-packages/libqutrub/classverb.py__init__zConjugStem.__init__;   s     



    N)__name__
__module____qualname____doc__r   r   r   r    r   r   r   r   .   s>          EGE    r   r   )standardsukunsuffixc                       e Zd ZdZefdZd ZddZd Zd 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S )	VerbClasszd
    Verb Class: represent a verb, prepare it to be conjugated and store the conjugation result
    c                    || _         t          | _        t          j        |          | _        t          j        |          | _        t          j        |          \  | _        | _	        t          j        | j	                  | _        t          j        | j	        | j        | j                  | _	        || _        d| _        i | _        | j         }g d}t          j        |          }t          j        |          | _        | j        }t'          |          | _        || j                 | _        |                     |          | _        d| _        |                                  |                                  |                                 r|                                  n|                                  t;          j        | j                   | _        | j        r| j                             dd           n| j                             dd           | j                             d| j                    | j                             d| j                   | !                    tD          j#        tD          j$                  | _%        | j        &                    | j%                   | j        r| j        '                                 | j        (                    | j                   d	S )
a   
        init method
        @param verb: the given verb
        @type verb: unicode.
        @param transitive: the verb is transitive or not
        @type transitive: Boolean.        
        @param future_type: The mark of the third radical letter in the verb, 
        used for triletiral verb only. Default value is Fatha; 
        @type future_type: unicode; one arabic letter (Fatha, Damma, Kasra).        
        F)
r   r   r   u   فعل ثلاثيu   فعل رباعيu   فعل خماسيu   فعل سداسيu   فعل سباعيu   فعل ثمانيu   فعل تساعيr   u   اللزوم/التعديu
   متعديu   لازمu
   الفعلu   نوع الفعلN))verbcache_standardar_verb	normalizeinternal_verbget_future_type_by_namefuture_typeuniformate_verbword_letters
word_marksarabysecondlast_charpast_harakauniformate_alef_origin
transitivehamza_zaidatab_conjug_stemstrip_harakatunvocalizedlenvlengthvtype_is_hamza_zaida	past_stem_prepare_past_stem_prepare_passive_past_stem_is_irregular_verb)_prepare_irregular_future_imperative_stem_prepare_future_imperative_stemconjugatedisplayConjugateDisplayconj_displayadd_attributconjugate_tense_pronounvconstTenseFuturePronounHuwafuture_formset_future_formsettransitivesetbab)r   r(   r6   r.   tab_typeverb_nms         r   r   zVerbClass.__init__`   s    	 -$.t44":;GG/6/Ft/L/L,	DO 0AA!8D,. . % !y` ` ` && .t44"7||dl+
  //88 !!!'')))""$$ 	3::<<<< 00222 -=diHH? 	V**+GWWWW**+GUUU&&}di@@@&&';TZHHH778J ))$*:;;;? 	.++---  !122222r   c                 "    d| _         d| _        dS )z+
        Delete instance 
        
        N)rG   r8   r   s    r   __del__zVerbClass.__del__   s    
 !#r   Textc                 :    | j                             |           dS )aK   
        Set the display mode as:
            - 'Text':
            - 'HTML':
            - 'HTMLColoredDiacritics':
            - 'DICT':
            - 'CSV':
            - 'GUI':
            - 'TABLE':
            - 'XML':
            - 'TeX':
            - 'ROWS':
        @param mode: the given mode to display result
        N)rG   setmode)r   modes     r   set_displayzVerbClass.set_display   s!     	!!$'''''r   c                 4    t          j         | j                  S )z
        Get The conjugation display class with result.
        @return: an object with result.
        @rtype: conjugatedisplay class
        )copyrG   rT   s    r   get_conj_displayzVerbClass.get_conj_display   s     y*+++r   c                 
   |}t          |          dk    s|                    t                    sdS t          |          dk    r>|                    t                    r$|d         t          k    r|d         t          k    rdS dS )u  
        Function to determine if the first HAMZA in the verb is not original
        ترجع إذا كانت الهمزة الأولى في الفعل غير أصلية
        Determine if the verb starts with Hamza and the Teh is not
        @param verb_normalized_unvocalized: the unvovalized form f the verb.
        @type verb_normalized_unvocalized: unicde
        @return: return True if the start Teh is not original
        @rtype: boolean; 
           F      T)r;   
startswithr   r	   r   )r   verb_normalized_unvocalizedr(   s      r   r>   zVerbClass._is_hamza_zaida   so    $ +t99>>$//%"8"8>5YY!^^ 6 6^Q$q'6//45r   c                    |}|}t          |          t          |          k     r|                    t          j                  }|dk     r|                    t          j                  }|dk     r|                    t          j                  }|dk    r\|dz   t          |          k     rF||         }||dz            }t          j        |         |         }|d|         |z   ||dz   d         z   }|S )u   
        Treat Harakat to be homogenized with letters in conjugation.
        إذا كان طول الحركات ألأصلية للفعل أقل من طول حركات الماضي المبني للمجهول
        هذا يعني وجود حركة طويلة
        نقوم بتحويل الحركة الطويلة إلى ما يوافقها

        @param original_harakat: given original harakatof the verb.
        @type original_harakat: unicode.
        @param applied_harakat: given harakat to be applied to  verb.
        @type applied_harakat: unicode.    
        @return: nesw harakat to be applied to the verb.
        @rtype: unicode.
        r   r`   Nra   )r;   findrJ   ALEF_HARAKAALEF_WAW_HARAKAALEF_YEH_HARAKAHOMOGENIZE_ALEF_HARAKA_TABLE)	r   original_harakatapplied_harakatr   	new_marksalef_haraka_posfirstsecondchanged_harakas	            r   _homogenize_harakatzVerbClass._homogenize_harakat   s     !#	 u::I&&#jj);<<O"""'**V-C"D"D"""'**V-C"D"D!##!(;c)nn(L(L!/2"?Q#675e<VD %&6&67.HOA-../0	r   c                    | j         }| j        }|}| j        dk    r>t          }t          }t
          | j        z   t          z   }t
          t          z   t          z   }n| j        dk    rNt          }t          }t          t
          z   t          z   t          z   }t          t
          z   t          z   t          z   }nH| j        dk    rt          }t          }|                    t                    rOt          t          z   t
          z   t          z   t          z   }t          t          z   t
          z   t          z   t          z   }nt          t
          z   t          z   t          z   t          z   }t          t
          z   t          z   t          z   t          z   }nw| j        dk    rlt          }t          }t          t
          z   t          z   t
          z   t          z   t          z   }t          t
          z   t          z   t
          z   t          z   t          z   }t          |          t          |          k     r,|                     ||          }|                     ||          }|}|}	|                    t                    s| j        r)|dd         }|dd         }|dd         }|dd         }
n| j        dk    r| j                             t                    rv| j        t          k    sO| j        t          k    rV| j        t          t          z   t          z   k    r6| j                             t                     s|dd         }|dd         }|}
n|}|}
||z   }||z   }|	                    t                    r|dd         }	|dd         }n| j        dk    rt| j                             t                    rU| j        t          k    s0| j        t          k    r5| j        t          t          z   t          z   k    r|dd         }	|dd         }n|}	| j        dk    r1|
                    t"          j                  r|
dd         t&          z   }
t)          t"          j        ||          | j        t"          j        <   t)          t"          j        ||          | j        t"          j        <   t)          t"          j        ||          | j        t"          j        <   t)          t"          j        ||          | j        t"          j        <   t)          t"          j        |
|          | j        t"          j        <   t)          t"          j        |
|          | j        t"          j        <   t)          t"          j        |
|          | j        t"          j        <   t)          t"          j        |
|          | j        t"          j        <   t)          t"          j        |	|          | j        t"          j        <   t)          t"          j        |	|          | j        t"          j        <   dS )u  
        Prepare the conjugation stems for future tenses 
        (future, jussive, subjective) and imperative tense.
        Those stems will be concatenated with conjugation affixes.
        This function store results in self.tab_conjug_stem. 
        This function prepare conjugation stems for the following tenses:
            - vconst.TenseFuture :  تصريف الفعل المضارع 
            - vconst.TenseJussiveFuture : تصريف الفعل المضارع المجزوم 
            - vconst.TenseSubjunctiveFuture : تصريف الفعل المضارع المنصوب 
            - vconst.TenseConfirmedFuture: المضارع المؤكد الثقيل
            - vconst.TensePassiveFuture :تصريف الفعل المضارع المبني للمجهول
            - vconst.TensePassiveJussiveFuture: تصريف الفعل المضارع المجزوم المني للمجهول
            - vconst.TensePassiveSubjunctiveFuture:تصريف الفعل المضارع المنصوب 
            - vconst.TensePassiveConfirmedFuture:المضارع المؤكد الثقيل المنبي للمجهول
            - vconst.TenseImperative:الفعل الامر
            - vconst.TenseConfirmedImperative: الفعل الامر المؤكد.
           r_         r`   N) r0   r1   r<   r   r   r   r.   r   rb   r   r;   rq   r	   r7   r   endswithr   rJ   ALEF_MAMDUDAr   r   rK   r8   TenseJussiveFutureTenseSubjunctiveFutureTenseConfirmedFutureTensePassiveFutureTensePassiveJussiveFutureTensePassiveSubjunctiveFutureTensePassiveConfirmedFutureTenseImperativeTenseConfirmedImperative)r   r   r   future_lettersfirst_future_markfirst_passive_future_markfuture_markspassive_future_marks	imp_marksimp_letterspassive_lettersrl   passive_markss                r   rD   z)VerbClass._prepare_future_imperative_stem  sb   $ # <1 %(-% 4#33e;L#(5=5#8  
 \Q %(-% 5=5058L#(5=5#85#@  \Q %(-%!!#&& M$u}u4u<uD',u}u'<u'Du'L$$$u}u4u<uD',u}u'<u'Du'L$$\Q %(-% 5=50585@5HL#(5=5#85#@5#H5#P  u::L))))33E<HHL#'#;#;E)$+ $+  	$d## 	&t'7 	&$QRR[N'+L#7#; %abbkOO\Q4#4#?#?#D#D		U	"	"(8%(?(?uU***&&v.. 	+$QRR[N'+L%OO$N%O%4	14HH !!$'' 		"!!""+K!!""II\Q4#4#?#?#D#D		U	"	"t'7'>'>uU***!!""+K!!""II!K
 <1!9!9&:M!N!N-crc2<?O 4>NI47 47V/0 ;E!>9;> ;>V67>H%~y?B ?BV:; =G#^Y=@ =@V89 ;E!?M;C ;CV67 BL(/=BJ BJV=> 	67		 	 	VAB DN*O]DL DLV?@ 8BY88 88V34 AK'iAA AAV<===r   c                     | j         | _        t          t          j        | j        | j                  | j        t          j        <   dS )uC  
        Prepare the conjugation stems for past tense.
        Those stems will be concatenated with conjugation affixes.
        This function store results in self.tab_conjug_stem. 
        This function prepare conjugation stems for the following tenses:
            - vconst.TensePast: الفعل الماضي.
        N)r,   r?   r   rJ   	TensePastr0   r1   r8   rT   s    r   r@   zVerbClass._prepare_past_stem  s=     +1;$+T_2> 2>V-...r   c                 0   | j         }| j        }t          |          dk    rB|                    t          j                  r#|d         t          k    r|dd         t          z   }| j        dk    rt          t          z   t          z   }n| j        dk    r t          t          z   t          z   t          z   }n| j        dk    rj|                    t                    r(t          t          z   t          z   t          z   t          z   }nbt          t          z   t          z   t          z   t          z   }n:| j        dk    r/t          t          z   t          z   t          z   t          z   t          z   }t          |          t          |          k     r|                     ||          }t          |          dk    r?|d	         t          j        k    r)| j        t          t          fv rt          j        t          z   }t%          t          j        ||          | j        t          j        <   dS )
uB  
        Prepare the conjugation stems for past tense.
        Those stems will be concatenated with conjugation affixes.
        This function store results in self.tab_conjug_stem. 
        This function prepare conjugation stems for the following tenses:
            - vconst.TensePast: الفعل الماضي
        rs   r`   Nrv   r_   rt   ru   ra   r   )r0   r1   r;   rw   rJ   rx   r   r   r<   r   r   r   rb   r   rq   
YEH_HARAKAr.   ALTERNATIVE_YEH_HARAKAr   TensePassivePastr8   )r   r   r   r   s       r   rA   z$VerbClass._prepare_passive_past_stem  s    #w<<1!1!1&2E!F!F!Hcrcl\1G<1!EME1MM\Q!EME1E9MM\Q!!#&& F % 5 = E % 5 = E\Q!EME1E9EAEIM u::M**** 44UMJJM }""}Q'76;L'L'L%//"9EAM8B-99 99V4555r   c                    t           j        |         |         d         }t           j        |         |         d         }| j        |         j        }| j        |         j        }|dk    r|}|d         }|dd         }nd}d}t
          |z   }|| j        d         v r| j        d         |         \  }	}
n)t          j        |          \  }	}
|	|
f| j        d         |<   ||z   |	z   }||dd         z   |
z   }||z   |	dd         z   }d	                    ||g          }|| j        d         v r| j        d         |         }n%t          j
        ||          }|| j        d         |<   d	                    ||g          }|| j        d	         v r| j        d	         |         }n%t          j        ||          }|| j        d	         |<   |S )
a/  
        Conjugate a verb in a given tense with a pronoun.
        @param tense: given tense
        @type tense: unicode name of the tense
        @param pronoun: given pronoun
        @type pronoun: unicode name of the pronoun
        @return: conjugated verb
        @rtype: unicode;        
        r   r`   r   Nr$   rv   -r#   r"   )rJ   TableTensePronounr8   r   r   r   r)   r*   uniformate_suffixjointreat_sukun2	standard2)r   r   pronounpre_valsuf_valstem_lstem_m	pre_val_l	pre_val_m	suf_val_l	suf_val_mconj_lconj_m	key_cacheconjs                  r   rI   z!VerbClass.conjugate_tense_pronoun  s    *51':1=*51':1=%e,4%e,2
 c>>Iq	IABBZFFII G# t*8444%)%8%B7%K"Y		%,%>w%G%G"Y	6?5KD)'2V#i/VCRC[(94V#im3 IIvv.//	+G444(1)<FF )&&99F6<D(3 IIvv.//	+J777&z29=DD$VV44D9=D
+I6r   Nc           
         |st           j        }|D ]}|t           j        k    r|                     |t           j                  }| j                            |t           j        |           |dd         }| j                            |t           j        |t          z              | j                            |t           j	        |t          z              | j                            |t           j        |t          z   t          z   t          z              | j                            |t           j        |t          z   t          z   t          z              | j                            |t           j        |t          z              | j                            |t           j        |t"          z   t$          z   t          z              | j                            |t           j        |           |                     |t           j                  }| j                            |t           j        |           |                     |t           j                  }| j                            |t           j        |           |                     |t           j                  }| j                            |t           j        |           |                     |t           j                  }| j                            |t           j        |           |                     |t           j                  }| j                            |t           j        |           |                     |t           j                  }	| j                            |t           j        |	           |                     |t           j                  }
| j                            |t           j        |
           | j                            |t           j        |
dd         t          z   t          z              |t           j        k    r!|                     |t           j                  }| j                            |t           j        |           |dd         }| j                            |t           j        |t          z              | j                            |t           j	        |t          z              | j                            |t           j        |t          z   t          z   t          z              | j                            |t           j        |t          z   t          z   t          z              | j                            |t           j        |t          z              | j                            |t           j        |t"          z   t$          z   t          z              | j                            |t           j        |           |                     |t           j                  }| j                            |t           j        |           |                     |t           j                  }| j                            |t           j        |           |                     |t           j                  }| j                            |t           j        |           |                     |t           j                  }	| j                            |t           j        |	           |                     |t           j                  }| j                            |t           j        |           |	                    t8          t:          z   t          z             r:| j                            |t           j        |	dd         t<          z   t          z   t>          z   t@          z              | j                            |t           j        |	dd         t<          z   t          z   t>          z   t          z   t          z              | j                            |t           j        |	dd         t<          z   t          z   t          z              | j                            |t           j        |	dd         t<          z   tB          z   tD          z   t          z              | j                            |t           j        |	t>          z   t@          z              | j                            |t           j        |	t>          z   t          z   t          z              | j                            |t           j        |	t          z              	*|t           j#        t           j$        t           j%        t           j&        t           j'        t           j(        t           j)        t           j*        fv r(|                     |t           j                  }| j                            |t           j        |           |                     |t           j                  }| j                            |t           j        |           |dd         }| j                            |t           j        t"          |z              | j                            |t           j        t8          |z              | j                            |t           j        t>          |z              |                     |t           j	                  }| j                            |t           j	        |           |                     |t           j                  }| j                            |t           j        |           | j                            |t           j        |           | j                            |t           j        |           | j                            |t           j        t8          |dd         z              |                     |t           j                  }| j                            |t           j        |           | j                            |t           j        t8          |dd         z              |                     |t           j                  }| j                            |t           j        |           | j                            |t           j        t8          |dd         z              |t           j+        k    s|t           j,        k    rAt           j-        D ]4}|                     ||          }| j                            |||           5| j.        s:t           j/        D ]-}t           j0        D ]}| j                            ||d           .| j        1                    | j        j2        |          }|r|S dS )z
        Conjugate a verb  with a list of tenses.
        @param listtense: given tense
        @type listtense: list of unicode
        @return: conjugated verb 
        @rtype: the type is given according to the display mode;        
        Nrv   r`   r   )3rJ   TABLE_TENSEr   rI   
PronounAnarG   addPronounAntar   PronounAntir   PronounAntumar   r	   PronounAntuma_fPronounAntumPronounAntunnar
   r   PronounNahnuPronounHunnaPronounHuma
PronounHumrL   
PronounHyaPronounHuma_fr   rw   r   r   r   r   r   r   r   rK   r|   ry   rz   r{   r}   r~   r   r   r   ImperativePronounsr6   TablePassiveTense&PronounsTableNotPassiveForUntransitivedisplayrY   )r   	listtenser   conj_anaconj_ana_without_last_mark
conj_nahnu
conj_hunna	conj_humaconj_hum	conj_huwaconj_hya	conj_antaconj_anta_without_future_letter	conj_anticonj_antuma
conj_antumconj_antunnapronr   results                       r   conjugate_all_tenseszVerbClass.conjugate_all_tenses  sS     	+*I n	= n	=E(((77&( (!%%eV->III-5crc]*!%%eV-?*502 2 2!%%eV-?*502 2 2!%%eV-Ae#D(* * *!%%eV-Ce#D(* * *!%%eV-@  !%%eV-Bf$U*, , ,!%%eV->III!99%&( (
!%%eV-@*MMM!99%#% %
!%%eV-@*MMM 88"$ $	!%%eV-?KKK77!# #!%%eV->III!99%#% %
!%%eV-@*MMM 88"$ $	!%%eV-?KKK77!# #!%%eV->III!%%eV-A"e#D(* * * *&11177!# #!%%eV->III-5crc]*!%%eV-?*502 2 2!%%eV-?*502 2 2!%%eV-Ae#D(* * *!%%eV-Ce#D(* * *!%%eV-@  !%%eV-Bf$U*, , ,!%%eV->III!99%#% %
!%%eV-@   "99%#% %
!%%eV-@   "99%#% %
!%%eV-@   !88"$ $	!%%eV-?KKK77!# #!%%eV->III%%c%io66 $%))%1BcrcN9,U236u<> > >%))%1EcrcN9,U236u<TAC C C %))%1CcrcN9,U2479 9 9
 %))%1BcrcN9,U236t;= = = = %))%1BcM%') ) )%))%1EcM%',. . .%))%1CdN$ $ $ $ 6-v/H%v'D')I0.	0 0 0
  77!# #!%%eV->   !88"$ $	!%%eV-?  2;ABB-/ !%%eV-@446 6 6!%%eV-?335 5 5!%%eV->335 5 5 !88"$ $	!%%eV-?   #::5$& &!%%eV-A  !%%eV-C  !%%eV-A  !%%eV-?KO#% % % "99%#% %
!%%eV-@  !%%eV->JqrrN"$ $ $  $;;E% '  '!%%eV-B  !%%eV-@L$$& & & &&000f555#6 = =D!99%FFD%))%t<<<< 	<1 < <"I < <D%))%s;;;;< $,,T->-C  	M	 	r   c           	         |t           j        k    rx|t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        fv r4| 	                    ||          }| j
                            |||           n|t           j        t           j        t           j        t           j        t           j        t           j        t           j        fv r| j
                            ||          }|dk    r | 	                    |t           j                  }|dd         }|t           j        k    r0| j
                            |t           j        |t&          z              n|t           j        k    r0| j
                            |t           j        |t(          z              nj|t           j        k    r@| j
                            |t           j        |t*          z   t&          z   t,          z              n|t           j        k    r@| j
                            |t           j        |t*          z   t&          z   t,          z              n|t           j        k    r0| j
                            |t           j        |t*          z              n|t           j        k    r>| j
                            |t           j        |t.          z   t0          z   t&          z              n:|t           j        k    r| j
                            |t           j                  }|dk    r | 	                    |t           j                  }| j
                            |t           j        |dd         t&          z   t,          z              
n|t           j        k    r=|t           j        t           j        t           j        t           j        t           j        t           j        fv r4| 	                    ||          }| j
                            |||           
n|t           j        t           j        t           j        t           j        t           j        t           j        fv r+| j
                            |t           j                  }|dk    rF| 	                    |t           j                  }| j
                            |t           j        |           |dd         }|t           j        k    r0| j
                            |t           j        |t&          z              	n|t           j        k    r0| j
                            |t           j        |t(          z              n|t           j        k    r@| j
                            |t           j        |t*          z   t&          z   t,          z              n|t           j        k    r@| j
                            |t           j        |t*          z   t&          z   t,          z              n2|t           j        k    r0| j
                            |t           j        |t*          z              n|t           j        k    r>| j
                            |t           j        |t.          z   t0          z   t&          z              n|t           j        t           j        t           j        fv r)| j
                            |t           j                  }|dk    rF| 	                    |t           j                  }| j
                            |t           j        |           |                    t8          t:          z   t&          z             r| j
                            |t           j        |dd         t<          z   t&          z   t>          z   t@          z              | j
                            |t           j        |dd         t<          z   t&          z   t>          z   t&          z   t,          z              | j
                            |t           j        |dd         t<          z   t&          z   t,          z              n| j
                            |t           j        |t>          z   t@          z              | j
                            |t           j        |t>          z   t&          z   t,          z              | j
                            |t           j        |t,          z              nQ|t           j!        t           j"        t           j#        t           j$        t           j%        t           j&        t           j'        t           j(        fv r|t           j        t           j        t           j        t           j        t           j        t           j        fv r4| 	                    ||          }| j
                            |||           nz|t           j        t           j        t           j        fv r;| j
                            |t           j                  }|dk    rF| 	                    |t           j                  }| j
                            |t           j        |           |dd         }	|t           j        k    r0| j
                            |t           j        t.          |	z              n|t           j        k    r0| j
                            |t           j        t8          |	z              nY|t           j        k    r.| j
                            |t           j        t>          |	z              n|t           j        t           j        t           j        t           j        fv r%| j
                            |t           j                  }
|
dk    rF| 	                    |t           j                  }
| j
                            |t           j        |
           |t           j        k    r&| j
                            |t           j        |
           |t           j        k    r&| j
                            |t           j        |
           |t           j        k    r6| j
                            |t           j        t8          |
dd         z              n|t           j        k    r| j
                            |t           j                  }|dk    rF| 	                    |t           j                  }| j
                            |t           j        |           | j
                            |t           j        t8          |dd         z              n
|t           j        k    r| j
                            |t           j                  }|dk    rF| 	                    |t           j                  }| j
                            |t           j        |           | j
                            |t           j        t8          |dd         z              nR|t           j)        k    s|t           j*        k    r2| 	                    ||          }| j
                            |||           | j
                            ||          S )a7  
        Conjugate a verb  for a pronoun in specific tense, 
        we use an homoginized conjugation 
        @param tense: given tense
        @type tense: unicode
        @param pronoun: given pronoun
        @type pronoun: unicode
        @return: conjugated verb 
        @rtype: unicode;        
        r   Nrv   r   r`   )+rJ   r   r   r   r   r   r   rL   r   rI   rG   r   r   r   r   r   r   r   get_conjr   r   r   r	   r
   r   r   r   rw   r   r   r   r   r   rK   r|   ry   rz   r{   r}   r~   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   s                r   conjugate_tense_for_pronounz%VerbClass.conjugate_tense_for_pronoun  s   $ F$$$6,f.A!3f6G &"4f6GI I I 33UGDD!%%eWd;;;; V/1C 4f6L!68 8 8  ,55eWEEs??#;;E% '  'H-5crc]*f000%))%1C.u46 6 6 6 222%))%1C.u46 6 6 6 444%))%1Ed]5(-/ / / / 666%))%1Gd]5(-/ / / / 333%))%1Dd]$ $ $ $ 555%))%1Fd]6)%/1 1 1
 V111,55eV=NOOs??#;;E% '  'H!%%eV-A"e#D(* * *f---6,f.A!4f6H&J[] ] ]33E7CC!%%eWd;;;; V/1C &"8&:M!# # #  ,55eV=NOOs??#;;E% '  'H%))%1B  -5crc]*f000%))%1C.u46 6 6 6 222%))%1C.u46 6 6 6 444%))%1ETM%',. . . . 666%))%1GTM%',. . . . 333%))%1DTM# # # # 555%))%1FTM&(.0 0 0 f/1E! ! ! !-66u"$ $	## $ < <U&!( !(I%))%1CYOOO%%c%io66 $%))%1BcrcN9,U236u<> > >%))%1EcrcN9,U236u<TAC C C%))%1CcrcN9,U2479 9 9 9 %))%1BcM%') ) )%))%1EcM%',. . .%))%1CdN$ $ $ v)6+D!6#@#V%E,*	, , , 6,f.@ 4f6I"$ $ $ 33E7CC!%%eWd;;;; V0&2D   -66u"$ $	## $ < <U&!( !(I%))%1C   3<ABB-/f111%))%1D88: : : : 222%))%1C779 9 9 9 111%))%1B779 9 9 V163I 47 7 7"/88$& &#%%"&">">u(#* #*K%))%1E! ! !f444%))%1G! ! !f222%))%1E! ! !f000%))%1CABB') ) ) F---!.77#% %
$$!%!=!=e'") ")J%))%1D     !%%eV->JqrrN"$ $ $ $ F///#099%% '  '3&&#'#?#?)$+ $+L%))%1F " " "!%%eV-@L$$& & &f,,,	&1	1	1//w??D!!%$777 ))%999r   c                     t          | j                  dk    rdS | j        dk    r"t          j        | _        t          j        | _        | j        | j        z   | j        z   }|t          j        v rdS dS )us  
        Return True if the verb is irregular, 
        founded in the irregular verb table
        Aإرجاع إّذا كان الفعل ضاذا.
        الأفعال العربية الخاصة هي
        رأى، أكل أمر سأل،
        # ج- إذا كان يتصرف من باب (مَنَعَ يَمْنَعُ)، 
        تحذف واوه, نحو: وَضَعَ، يَضَعُ، وَجَأَ يَجَأُ،
        وَدَعَ يَدَعُ، وَزَعَ يَزَعُ، وَضَأَ يَضَأُ، وَطَأَ يَطَأُ، 
        وَقَعَ يَقَعُ، وَلَغَ يَلَغُ، وَهَبَ يَهَبُ، 
        عدا خمسة أفعال هي: (وَبَأ)، و(وَبَهَ)، و(وَجَعَ)، و(وَسَعَ)، و(وَهَلَ)،
        فلا تحذف منها الواو؛ فنقول: يَوْبَأُ، يَوْبَهُ، يَوْجَعُ، يَوْسَعُ، يَوْهَلُ.
        الأفعال (وَبَأ)، و(وَبَهَ)، و(وَجَعَ)، و(وَسَعَ)، و(وَهَلَ)، الفعل وبَأ يوبأ        
        @return:True if irregular
        @rtype: Boolean
        rs   Fu   ءرىT)	r;   r0   r2   r   r4   r   r.   rJ   IRREGULAR_VERB_CONJUGr   keys     r   rB   zVerbClass._is_irregular_verb  ss    " t !!Q&&5  I--#(; $)K #d&66t7GGCf222tur   c                     | j         | j        z   | j        z   }|t          j        v r"t          j        |         t          j                 S | j         S )z
        Get the future stem for irregular verb.
        @return: the future conjuagtion stem
        @rtype: unicode;        
        )r0   r4   r.   rJ   r   rK   r   s     r   _get_irregular_future_stemz$VerbClass._get_irregular_future_stem  sI      001AA6////4V5GHH$$r   c                     | j         | j        z   | j        z   }|t          j        v r"t          j        |         t          j                 S | j         S )z
        Get the passive future stem for irregular verb.
        @return: the passive future conjuagtion stem
        @rtype: unicode;        
        )r0   r4   r.   rJ   r   r|   r   s     r   !_get_irregular_passivefuture_stemz+VerbClass._get_irregular_passivefuture_stem  sI      001AA&.../4V5NOO$$r   c                     | j         | j        z   | j        z   }|t          j        v r"t          j        |         t          j                 S | j         S )z
        Get the imperative stem for irregular verb.
        @return: the passive imperative conjuagtion stem
        @rtype: unicode;        
        )r0   r4   r.   rJ   r   r   r   s     r   _get_irregular_imperative_stemz(VerbClass._get_irregular_imperative_stem  sI     $"2243CC6////4V5KLL$$r   c                 >   |                                  r|                                 \  }}t          t          j        ||          | j        t          j        <   t          t          j        ||          | j        t          j        <   t          t          j        ||          | j        t          j        <   t          t          j        ||          | j        t          j        <   | 	                                \  }}t          t          j
        ||          | j        t          j
        <   t          t          j        ||          | j        t          j        <   t          t          j        ||          | j        t          j        <   t          t          j        ||          | j        t          j        <   |                                 \  }}t          t          j        ||          | j        t          j        <   t          t          j        ||          | j        t          j        <   dS )z
        Prepare the conjugation stems for future tenses 
        (future, jussive, subjective) and imperative tense.
        Those stems will be concatenated with conjugation affixes.
        F)rB   r   r   rJ   rK   r8   ry   rz   r{   r   r|   r}   r~   r   r   r   r   )r   r   r   letters1marks1letters2marks2s          r   rC   z3VerbClass._prepare_irregular_future_imperative_stem	  s    ""$$ 	K#>>@@We 8B80 80D !34>H%w?7 ?7D !:;BL)7EC; C;D !>?@J'%A9 A9D !<= #'"H"H"J"JX>H%x&?: ?:D !:;EO,hFA FAD !AB v;XOO  !EF v98fMM  !CD #'"E"E"G"GX;E"Hv<7 <7D !78 v66JJ  !@Aur   c                 8    | j                             ||          S )a9  
        Get the conjugated verb by tense and pronoun.
        @param tense: tense of the added conjuagtion.
        @type tense: unicode
        @param pronoun: pronoun of the added conjuagtion.
        @type pronoun: unicode
        @return : conjugated form of verb if exists.
        @rtype : unicode
        )rG   r   )r   r   r   s      r   r   zVerbClass.get_conj0  s      ))%999r   c                 B    t           j                            |d          S )z
        Get the features of  given pronoun.
        @param pronoun: pronoun of conjuagtion.
        @type pronoun: unicode
        @return : dictionary of pronoun attributes.
        @rtype : dictionary
        N)rJ   PRONOUN_FEATURESget)r   r   s     r   get_pronoun_featureszVerbClass.get_pronoun_features<  s     &**7D999r   c                 B    t           j                            |d          S )z
        Get the features of  given tense.
        @param tense: tense of the conjuagtion.
        @type tense: unicode
        @return : dictionary of tense attributes.
        @rtype : dictionary
        N)rJ   TENSE_FEATURESr   )r   r   s     r   get_tense_featureszVerbClass.get_tense_featuresE  s     $((555r   )rV   )N)r   r   r   r    r   r   rU   rZ   r]   r>   rq   rD   r@   rA   rI   r   r   rB   r   r   r   rC   r   r   r   r!   r   r   r&   r&   L   sx        & 6; G3 G3 G3 G3T$ $ $( ( ( (&, , ,  6     HGA GA GAR
> 
> 
>'9 '9 '9R> > >LA A A AF\: \: \:@  B% % %% % %% % % $ $ $N
: 
: 
:: : :6 6 6 6 6r   r&   )r    r\   pyarabic.arabyr2   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   libqutrub.ar_verbr*   libqutrub.verb_const
verb_constrJ   libqutrub.conjugatedisplayrE   r   r)   r&   r!   r   r   <module>r      s  .        D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D $ # # # # # & & & & & & 5 5 5 5 5 5       6  ! !A6 A6 A6 A6 A6 A6 A6 A6 A6 A6r   