
    -iu                     h   d Z ddlZej                            d           ej                            d           ej                            d           ddlZddlmZ ddlmZ ddl	Z	ddl
mZ 	 dd	l	mZ n#  Y nxY w G d
 de	j        j                  Zd Zedk    r e             ej         dS dS )zJ
stemmedWord represents the data resulted from the morpholocigal analysis
    Nz../zmishkal/libz../lib)xor   )	syn_const)stemmedwordc                      e Zd ZdZdJd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dKdZd ZdLdZdLdZdKdZd Zd Zd Zd Zd ZdKdZd Zd ZdLdZdKd 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.d0 Z/d1 Z0d2 Z1d3 Z2d4 Z3d5 Z4d6 Z5d7 Z6d8 Z7d9 Z8d: Z9d; Z:d< Z;d= Z<d> Z=d? Z>d@ Z?dA Z@dB ZAdC ZBdD ZCdE ZDdF ZEdG ZFdH ZGdI ZHdS )MStemmedSynWordzR
    stemmedWord represents the data resulted from the morpholocigal analysis
    Nc                    |rH|j         | _         t          j        | j                  | _        t          j        | j                  | _        d| _        d| _        d| _	        | 
                                r|                                 | _	        |                                 rK|                                 | _	        |                                 | _        |                                 | _        |                                 | _        |                                 | _        d| _        d| _        d| _        d| _        || _        i | _        i | _        i | _        i | _        d| _        d| _        d S )Nr   F )__dict__arabystrip_tashkeel	vocalizedunvocalizedoriginalunvoriginaltag_verbal_factortag_nominal_factortag_kana_rafe3is_verb_is_kana_rafe3is_stopword#_StemmedSynWord__get_nominal_factor"_StemmedSynWord__get_verbal_factor_is_additiontag_addition	_is_break	tag_breakforced_word_casesyntaxsemanticforced_wordtypeordernextprevioussem_nextsem_previousscorerule)selfresult_dictr#   s      U/var/www/html/speakWrite/venv/lib/python3.11/site-packages/sylajone/stemmedsynword.py__init__zStemmedSynWord.__init__%   sG     	D'0DM % 4T^ D DD % 4T] C CD$%$%$)<<>> 	:$($7$7$9$9D 	A$($7$7$9$9D&*&?&?&A&AD#&*&>&>&@&@D"!..00..** %$
	
			    c                     dS )z desctructor N r*   s    r,   __del__zStemmedSynWord.__del__I   s    r.   c                 |    | j         r| j         S | j        rt          j        | j                  | _         ndS | j         S )z
        Get the unvocalized form of the input word
        @return: the given unvocalized.
        @rtype: unicode string
        r   )r   r   r   r   r1   s    r,   get_unvocalizedzStemmedSynWord.get_unvocalizedO   sH      	##~ #(#7#G#G  sr.   c                 |    | j         r| j         S | j        rt          j        | j                  | _         ndS | j         S )z
        Get the unvocalized  original form of the input word
        @return: the given unvocalized original.
        @rtype: unicode string
        r   )r   r   r   r   r1   s    r,   get_unvoriginalzStemmedSynWord.get_unvoriginal^   sH      	$##} $)$8$G$G  s##r.   c                     || _         dS )
        Add a position number in the case word list.
        @param order: the order of  the stemmed word in the word case list.
        @tyep order: integer
        Nr#   )r*   r#   s     r,   	set_orderzStemmedSynWord.set_orderm   s     


r.   c                     | j         S )r8   r9   r1   s    r,   	get_orderzStemmedSynWord.get_orderu        zr.   c                     || _         dS )z
        Set the word case score
        @param _score: the _score of  the stemmed word in the word case list.
        @tyep _score: integer
        Nr(   )r*   _scores     r,   	set_scorezStemmedSynWord.set_score}   s     


r.   c                     | j         S )z
        get the case word score
        @param _score: the _score of  the stemmed word in the word case list.
        @tyep _score: integer
        r?   r1   s    r,   	get_scorezStemmedSynWord.get_score   r=   r.   c                     | j         S )zy
        Get the syntax form of the input word
        @return: the given syntax.
        @rtype: unicode string
        r    r1   s    r,   
get_syntaxzStemmedSynWord.get_syntax   s     {r.   c                     || _         dS )z}
        Set the syntax word
        @param newsyntax: the new given syntax.
        @type newsyntax: unicode string
        NrE   )r*   	newsyntaxs     r,   
set_syntaxzStemmedSynWord.set_syntax   s     !r.   c                 H    d                     | j        |g          | _        dS )zq
        Add a new tag to syntax field
        @param tag: the new added tag.
        @tyep tag: unicode
        :N)joinr    )r*   tags     r,   
add_syntaxzStemmedSynWord.add_syntax   s"     xxc 233r.   c                     | j         S )z}
        Get the semantic form of the input word
        @return: the given semantic.
        @rtype: unicode string
        r!   r1   s    r,   get_semanticzStemmedSynWord.get_semantic   s     }r.   c                     || _         dS )z
        Set the semantic word
        @param newsemantic: the new given semantic.
        @type newsemantic: unicode string
        NrP   )r*   newsemantics     r,   set_semanticzStemmedSynWord.set_semantic   s     %r.   r   c                     || j         |<   dS )z
        Add  next word position number, if the word is realted
        @param next: the next of  the stemmed word in the word case list.
        @tyep next: integer
        N)r$   r*   nextwweights      r,   add_nextzStemmedSynWord.add_next   s     "	%r.   c                 N    t          | j                                                  S z
        get the next positions.
        @param next: the next of  the stemmed word in the word case list.
        @tyep next: integer
        )listr$   keysr1   s    r,   get_nextzStemmedSynWord.get_next   s     DINN$$%%%r.   c                     |s| j         i k    S t          t          | j                                                                       |                    S )a  
        get True if current word has next relations. 
        If The next is given, it returns if the next has relation with current. 
        @param next: a stemmedsynword as next of the current word case.
         if it's None, the fucntion return if there are relation.
        @type next: stemmedsynword.
        @return: if the word has next relations
        @rtype: boolean
        )r$   boolsetr]   intersectionr*   rW   s     r,   has_nextzStemmedSynWord.has_next   sK      	C9?" DINN,,--::5AABBBr.   c                 t    |s| j         i k    S | j                             |                                          S )a  
        get True if current word has previous relations.
         If The previous is given, it returns if the previous 
         has relation with current. 
        @param previous: a stemmedsynword as previous of 
        the current word case. if it's None, the fucntion 
        return if there are relation.
        @type previous: stemmedsynword.
        @return: if the word has previous relations
        @rtype: boolean
        )r%   has_keyr<   )r*   r%   s     r,   has_previouszStemmedSynWord.has_previous   s;      	?=B&&=((););)=)=>>>r.   c                     || j         |<   dS )z
        Add the previous position of the related word.
        @param previous: the previous of  the stemmed word in the word case list.
        @tyep previous: integer
        N)r%   r*   r%   rX   s      r,   add_previouszStemmedSynWord.add_previous   s     #)hr.   c                     | j         S )z)
        get the selection rule.
        r)   r1   s    r,   get_rulezStemmedSynWord.get_rule   s     yr.   c                     || _         dS )z(
        set the selection rule
        Nrl   )r*   r)   s     r,   set_rulezStemmedSynWord.set_rule   s     			r.   c                 N    t          | j                                                  S )z9
        get all privous word list of relations.
        )r\   r%   r]   r1   s    r,   get_previouszStemmedSynWord.get_previous   s      DM&&(()))r.   c                 8    | j                             |d          S )z
        get the previous relation between the current case and the previous given by order
        @param previous_order: the previous of  the stemmed word 
        in the word case list.
        @tyep previous_order: integer
        r   )r%   get)r*   previous_orders     r,   get_previous_relationz$StemmedSynWord.get_previous_relation   s     }  333r.   c                 8    | j                             |d          S )z
        get the next relation between the current case and the next given by order
        @param next_order: the next of  the stemmed word 
        in the word case list.
        @tyep next_order: integer
        r   )r$   rs   )r*   
next_orders     r,   get_next_relationz StemmedSynWord.get_next_relation  s     y}}Z+++r.   c                     || j         |<   dS )z
        Add  next word position number, if the word is semanticly related
        @param next: the next of  the stemmed word in the word case list.
        @tyep next: integer
        N)r&   rV   s      r,   add_sem_nextzStemmedSynWord.add_sem_next  s      &er.   c                 N    t          | j                                                  S r[   )r\   r&   r]   r1   s    r,   get_sem_nextzStemmedSynWord.get_sem_next  s      DM&&(()))r.   c                     | j         i k    S )z
        get True if current word has semantic previout relations
        @return: if the word has previous relations
        @rtype: boolean
        r'   r1   s    r,   has_sem_previouszStemmedSynWord.has_sem_previous  s      B&&r.   c                     |s| j         i k    S t          t          | j                                                                       |                    S )z
        get True if current word has semantic next relations
        @return: if the word has next relations
        @rtype: boolean
        )r&   r`   ra   r]   rb   rc   s     r,   has_sem_nextzStemmedSynWord.has_sem_next%  sK      	'=B&&C**,,--::5AABBBr.   c                     || j         |<   dS )z
        Add the previous position of the semantic related word.
        @param previous: the previous of  the stemmed word in 
        the word case list.
        @tyep previous: integer
        Nr~   ri   s      r,   add_sem_previouszStemmedSynWord.add_sem_previous0  s     (.(###r.   c                 N    t          | j                                                  S )z
        Add a position number in the case word list.
        @param previous: the previous of  the stemmed word in 
        the word case list.
        @tyep previous: integer
        )r\   r'   r]   r1   s    r,   get_sem_previouszStemmedSynWord.get_sem_previous:  s!     D%**,,---r.   c                     d| _         dS )z
        Add a new tag to syntax field as foced case
        @param tag: the new added tag.
        @tyep tag: unicode
        TNr   r1   s    r,   forced_casezStemmedSynWord.forced_caseC  s     !%r.   c                     d| _         dS )z
        Add a new tag to syntax field as foced word type (noun, verb)
        @param tag: the new added tag.
        @tyep tag: unicode
        TNr"   r1   s    r,   force_wordtypezStemmedSynWord.force_wordtypeL  s      $r.   c                     | j         S z~
        verify if the word is a forced word type (noun, verb)
        @return: True/False
        @tyep tag: Boolean
        r   r1   s    r,   is_forced_casezStemmedSynWord.is_forced_caseT  s     $$r.   c                     | j         S r   r   r1   s    r,   is_forced_wordtypez!StemmedSynWord.is_forced_wordtype\  s     ##r.   c                     |                                  sd|                                 v rdS |                                 t          j        v rdS dS )j
        Return True if the word is a  Rafe3.
        @return:  Rafe3.
        @rtype: True/False
        u   كان و أخواتهاTF)has_encleticget_tagsr6   r   KanaSisters_LISTr1   s    r,   r   zStemmedSynWord._is_kana_rafe3g  sT     !!## 	#t}}664!!##y'AAA4ur.   c                     d|                                  v sd|                                  v r|                                 sdS dS )u   
        Return True if the word is a  nominal addition اسم إضافة مثل نحو ومعاذ
        @rtype: True/False
        u   اسم إضافةu
   إضافةTF)r   r   r1   s    r,   r   zStemmedSynWord._is_additionv  sE    
 !DMMOO33}7W7Waeararatat7W4ur.   c                     |                                  pRd|                                 v p;|                                 p'|                                 p|                                  S )uw   
        Return True if the word can be added like  مديرو and not مديرون
        @rtype: True/False
        u   لايضاف)is_additionr   
is_defined	is_tanwinr   r1   s    r,   need_additionzStemmedSynWord.need_addition  s    
 !!  O/T]]__*L  +NPTP_P_PaPa  +Nfjftftfvfv  +Nz~  {L  {L  {N  {N  &O  	Or.   c                     |                                  r*|                                 r|                                 rdS dS )ui   
        Return True if the word can be an addition مضاف إليه
        @rtype: True/False
        TF)
is_majrouris_adjr   r1   s    r,   is_additionablezStemmedSynWord.is_additionable  sC     ?? 	 ;;== T__%6%6 tur.   c                 V   d|                                  v r|                                 syd| _        d|                                 v r| xj        dz  c_        d|                                 v r| xj        dz  c_        d|                                 v r| xj        dz  c_        | j        S )	u  
        Return int code of verbal factor.
        the inflected cases are coded in binary like
        not defined        : 0  00000
        factor             : 1  00001      
        Rafe3              : 2  00010
        Naseb              : 4  00100
        Jar                : 8  01000
        Jazem              : 16 10000
        active             : 32 100000
        this codification allow to have two verb factor for the same case, 
        like feminin plural which ahve the same mark for Nasb and jar
هذا الترميز يرمز حالتين في وقت واحد
        النصب والجر
        @return: verbal factor state numeric code
        @rtype:        
        u   فعلr      رافع      ناصب   u   جازم   )get_object_typer   r   
get_actionr1   s    r,   __get_verbal_factorz"StemmedSynWord.__get_verbal_factor  s    2 ,,....t7H7H7J7J.%&D"doo////&&!+&&doo////&&!+&&doo////&&",&& %%r.   c                    d|                                  v rd| _        d|                                 v r5|                                 s| xj        dz  c_        n| xj        dz  c_        d|                                 v r5|                                 s| xj        dz  c_        n| xj        dz  c_        d|                                 v r&d|                                 v r| xj        d	z  c_        d
|                                 v r$|                                 s| xj        d	z  c_        d|                                 v rd| _        | j        S )ui  
        Return int code of nominal factor.
        the inflected cases are coded in binary like
        not defined        : 0  00000
        factor             : 1  00001      
        Rafe3              : 2  00010
        Naseb              : 4  00100
        Jar                : 8  01000
        this codification allow to have two noun factor for the same case, 
        like feminin plural which ahve the same mark for Nasb and jar
هذا الترميز يرمز حالتين في وقت واحد
        النصب والجر
        @return: nominal factor state numeric code
        @rtype:        
        u   اسمr   r   r   r   r      اسم إشارةu   جر   u   جار   ضمير   )r   r   r   r   r   r1   s    r,   __get_nominal_factorz#StemmedSynWord.__get_nominal_factor  se   0 ,,....&'D#doo////((** 1++q0+++++q0++doo////))++ 1++q0+++ ++q0++#t}}66t}}..++q0++))))$2C2C2E2E)##q(##$--//))&+D#&&r.   c                 .    d|                                  v S )u   
        Return True if the word is jonction عطف منفصل.

        @return: is jonction.
        @rtype: True/False
        u   متبع)r   r1   s    r,   is_jonctionzStemmedSynWord.is_jonction  s     t0000r.   c                 .    d|                                  v S )u   
        Return True if the word is substitute مبدل منه.

        @return: is substituted.
        @rtype: True/False
        r   r   r1   s    r,   is_substitutedzStemmedSynWord.is_substituted  s     %77r.   c                 .    d|                                  v S )u   
        Return True if the word is confirmation توكيد.

        @return: is confirmation.
        @rtype: True/False
        u
   توكيدr   r1   s    r,   is_confirmationzStemmedSynWord.is_confirmation   s     00r.   c                     t           j                            |           rdS |                                 rd|                                 v rdS dS )zk
        Return True if the word has break.

        @return: is break.
        @rtype: True/False
        TbreakF)r   StemmedWordis_break	is_pounctr   r1   s    r,   r   zStemmedSynWord._is_break	  sT     "++D11 		4 ^^ 	'T]]__"<"<4 5r.   c                     | j         S )zj
        Return True if the word has break.
        @return: is break.
        @rtype: True/False
        )r   r1   s    r,   r   zStemmedSynWord.is_break!  s     ~r.   c                     | j         S )z
        Return True if the word mark the begin of next sentence.
        @return: direct initial.
        @rtype: True/False
        )tag_initialr1   s    r,   
is_initialzStemmedSynWord.is_initial3  s     r.   c                     d|                                  v p+d|                                  v pd|                                  v S )z
        Return True if the word has the 3rd person.
        @return: has the 3rd persontense.
        @rtype: True/False
        r   u   اسم موصولr   r   r1   s    r,   
is_pronounzStemmedSynWord.is_pronoun;  s_     dmmoo-  E1E1X  E]quy  vC  vC  vE  vE  ^E  	Er.   c                 .    d|                                  v S )z7
        return True if the word accept Tanwin
        u   ينونr   r1   s    r,   canhave_tanwinzStemmedSynWord.canhave_tanwinD  s     dmmoo--r.   c                 6    t          | j        dz  dz            S )zy
        Return True if the word is a  Rafe3 of verb
        @return:  Rafe3 of verb.
        @rtype: True/False
        r   r`   r   r1   s    r,   is_verb_rafe3zStemmedSynWord.is_verb_rafe3J       D*Q.2333r.   c                 6    t          | j        dz  dz            S )zr
        Return True if the word is a  Naseb of verb.
        @return:  Naseb.
        @rtype: True/False
        r   r   r   r1   s    r,   is_verb_nasebzStemmedSynWord.is_verb_nasebR  r   r.   c                 6    t          | j        dz  dz            S )zj
        Return True if the word is a  Jazem.
        @return:  Jazem.
        @rtype: True/False
        r   r   r   r1   s    r,   is_jazemzStemmedSynWord.is_jazemZ  s     D*R/!3444r.   c                 2    t          | j        dk              S )zy
        Return True if the word is a  a jobless of verb.
        @return:  Njobless.
        @rtype: True/False
        r   r   r1   s    r,   is_verb_jobless_factorz%StemmedSynWord.is_verb_jobless_factora  s     D*a/000r.   c                 *    t          | j                  S )z
        Return True if the word is a  nominal factor.
        @return:  is a  nominal factor.
        @rtype: True/False
        r`   r   r1   s    r,   is_nominal_factorz StemmedSynWord.is_nominal_factori  s     D+,,,r.   c                 6    t          | j        dz  dz            S )r   r   r   r1   s    r,   is_rafe3zStemmedSynWord.is_rafe3r       D+a/!3444r.   c                 6    t          | j        dz  dz            S )zz
        Return True if the word is a  Naseb of noun.
        @return:  Naseb of noun.
        @rtype: True/False
        r   r   r   r1   s    r,   is_nasebzStemmedSynWord.is_nasebz  r   r.   c                 `    t          | j        dz  dz            o|                                  S )zf
        Return True if the word is a  Jar.
        @return:  Jar.
        @rtype: True/False
        r   r   )r`   r   r   r1   s    r,   is_jarzStemmedSynWord.is_jar  s3     D+a/!344PT=N=N=P=P9PPr.   c                 B    |                                  t          j        v S )z
        Return True if the word is a  condition factor.
        @return:  condition factor.
        @rtype: True/False
        )get_originalr   CONDITION_FACTORSr1   s    r,   is_condition_factorz"StemmedSynWord.is_condition_factor  s       ""i&AAAr.   c                     | j         S )r   )r   r1   s    r,   is_kana_rafe3zStemmedSynWord.is_kana_rafe3  s     ""r.   c                     | j         S )u   
        Return True if the word is a  Addition اسم إضافة مثل نحو ومعاذ.
        @return:  is a  addition.
        @rtype: True/False
        )r   r1   s    r,   r   zStemmedSynWord.is_addition  s       r.   c                 *    t          | j                  S )z
        Return True if the word is a  verbal factor.
        @return:  is a  verbal factor.
        @rtype: True/False
        r   r1   s    r,   is_verbal_factorzStemmedSynWord.is_verbal_factor  s     D*+++r.   c                     t          |                                 |                                           }t          |                                 |                                           }|o|S )z
        Return True if the current word is equal in definition with otherword.
        @return:  equal or not.
        @rtype: True/False
        )r   r   r   )r*   	otherwordeq_defndeq_tnwns       r,   
eq_definedzStemmedSynWord.eq_defined  s_     4??,,y/C/C/E/EFFF4>>++i.A.A.C.CDDD#G#r.   c                     |                                  r|                                 pO|                                 o|                                p'|                                 o|                                S )u   
        Return True if the current word is equal in case إعراب with otherword.
        @return:  equal or not.
        @rtype: True/False
        )r   
is_mansoub
is_marfou3r*   r   s     r,   eq_casezStemmedSynWord.eq_case  sm     //##>	(<(<(>(> =!!<i&:&:&<&<=!!;Y%9%9%;%;	>r.   c                     |                                  r|                                 p'|                                 o|                                S )u   
        Return True if the current word is equal in gender النوع ذكر أنثى with otherword.
        @return:  equal or not.
        @rtype: True/False
        )
is_femininis_masculinr   s     r,   	eq_genderzStemmedSynWord.eq_gender  sL     //##>	(<(<(>(> ?!!=i&;&;&=&=	
r.   c                     |                                  r|                                 pO|                                 o|                                p'|                                 o|                                S )u   
        Return True if the current word is equal in number العدد مفرد مثنى جمع with otherword.
        @return:  equal or not.
        @rtype: True/False
        )	is_pluralis_dual	is_singler   s     r,   	eq_numberzStemmedSynWord.eq_number  sk     ..""<y':':'<'< <,,..8Y%6%6%8%8<  :Y%8%8%:%:	r.   c                     |                                  r|                                 pO|                                 o|                                p'|                                 o|                                S )u   
        Return True if the current word is equal in person الشخض متكلم مخاطب غائب with otherword.
        @return:  equal or not.
        @rtype: True/False
        )is_speaker_personis_present_personis_absent_personr   s     r,   	eq_personzStemmedSynWord.eq_person  sv     ((**Ly/J/J/L/L K''))Ki.I.I.K.KK&&((IY-G-G-I-I	Lr.   c                 r   |                                  r|                                 s|                                 sq|                                 s^|                                 sK| j                            t          j                  r#| j        dd         t          j	        z   | _        dS | j                            t          j
                  r#| j        dd         t          j        z   | _        dS | j                            t          j        t          j        z             r#| j        dd         t          j        z   | _        dS | j                            t          j        t          j        z             r:| j        dd         t          j        z   t          j        z   | _        dS dS dS dS dS dS dS )z
        ajust the Tanwin case, if the word is independent from the next one.
        @return:  Nothing.
        @rtype: 
        Nr	   )is_nounr   r   r   
is_mamnou3r   endswithr   DAMMADAMMATANKASRAKASRATANTEH_MARBUTAFATHAFATHATANALEFr1   s    r,   ajust_tanwinzStemmedSynWord.ajust_tanwin  s    <<>> 
	O$"2"2"4"4 
	OT__=N=N 
	O!!##
	O,0OO,=,=
	O ~&&u{33 O!%!4U^!C((55 O!%!4U^!C(():5;)FGG O!%!4U^!C((UZ)?@@ O!%!4U^!CEJ!N
	O 
	O 
	O 
	O 
	O 
	O 
	O 
	O 
	O 
	OO Or.   c                    d}| j                             |          r6t          | j        |         |dz            | j         |<   || j         |         z  }| j                            |          r9t          | j        |         |dz            | j        |<   || j        |dz           z  }|t	          | j                   dz  t	          | j                  dz  z   z  }|t	          | j                  dz  t	          | j                  dz  z   z  }|t          t          j	        | j
        dz             d          z  }t          | j        |          | _        dS )aN  
        Recalculate score according to previous node.
        @param previous_case_position: the pervious position in previos table
        @type  previous_case_position: integer
        @param previous_score: the word case previous score
        @type  previous_score: integer.
        @return: nothing
        @rtype: void
        r   r   N)r'   rf   maxr%   lenr&   r$   roundmathlogfreqr(   )r*   previous_case_positionprevious_scorer(   s       r,   recalculate_scorez StemmedSynWord.recalculate_score  sX    $$%;<< 	@8;M01>!3C9E 9ED45d'(>??E=  !788 	>58M01>13D6F 6FDM01dm$:1$<==E#d'((*C,>,>q,@@@ 	C&&q(TY)99: 	%1--q111
 $*e,,


r.   c                 8   d| _         t          | j                  dz  | _         | xj         t          | j                  dz  z  c_         | xj         t          | j                  dz  z  c_         | xj         t          | j                  dz  z  c_         | xj         t          t          j        | j	        dz             d          z  c_         | xj         | 
                                dz  z  c_         |                     dt          | j                   z              dS )	zR
        Recalculate score.
        @return: nothing
        @rtype: void
        r   
   d   r   r   2   zScr:N)r(   r  r$   r%   r'   r&   r	  r
  r  r  r   rN   strr1   s    r,   calculate_scorezStemmedSynWord.calculate_score  s     

 $)nnR'


s4=))",,



s4,--c11



s4=))#--



uTXdik22A666



t''))",,

s4:./////r.   c                 T    | j         | j        | j        | j        d}| j        }||d<   |S )z/
        get dictionary of attributes 
        )SPSNPNr    )r'   r&   r%   r$   r   )r*   r    ret_dicts      r,   get_dictzStemmedSynWord.get_dict1  s=     (]MI  =#r.   c                     d| j         d         d| j         d         d}| j                                         D ]}|d|d| j         |         dz  }|                    d          S )	z/
        represent the class as string
        'r#   z':r   z, 
 z	'z':	utf8)r   r]   encode)r*   textks      r,   __repr__zStemmedSynWord.__repr__@  s      #'-"8"8"8k"""$##%% 	A 	AADAAAt}Q/?/?/?@@DD{{6"""r.   )Nr	   )r   )N)I__name__
__module____qualname____doc__r-   r2   r4   r6   r:   r<   rA   rC   rF   rI   rN   rQ   rT   rY   r^   rd   rg   rj   rm   ro   rq   ru   rx   rz   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r#  r0   r.   r,   r   r   !   so        " " " "H       $ $ $          ! ! !4 4 4  % % %" " " "& & &C C C C? ? ? ?") ) ) )    * * *
4 4 4, , ,& & & &* * *' ' '	C 	C 	C 	C. . . .. . .% % %$ $ $% % %$ $ $    O O O  %& %& %&P1' 1' 1'f1 1 18 8 81 1 1  0  $     E E E. . .4 4 44 4 45 5 51 1 1- - -5 5 55 5 5Q Q QB B B# # #! ! !, , ,$ $ $> > >
 
 
	 	 	L L LO O O&%- %- %-T0 0 0(  # # # # #r.   r   c                  4   t          d           i } ddddddddd	ddd
dddd} t          j        |           } t          |           }t          |                                           t          |                                           t          |           dS )z
    main test
    testu   الحياةu   الْحَيَاةُu   الr   u   حياةu   ُu   تعريف::مرفوع*r   u   Noun:مصدرu   حَيَاةٌ)wordr   	procleticprefixstemsuffixencletictagsr  roottemplatetyper   r    r!   N)printr   r   r   r  r   )rdictstmwrds     r,   mainlyr7  K  s     
&MMME%0 . $)' E* #E**EE""F	&//

	&



	&MMMMMr.   __main__)r'  syspathappendr
  operatorr   pyarabic.arabyr   qalsadir   r   r   r   r   r7  r$  NOMINAL_FACTOR_LISTr0   r.   r,   <module>r@     s>    


                           $ $ $ $ $ $
$$$$$$$
Dg# g# g# g# g#g)5 g# g# g#T  @ z
FHHH!!!! s   0A7 7A;