
    -iq                         d Z ddlZej                            ej                            e          d          ZddlmZ ddl	m
Z
 i Zd Zej        dfdZd ZdS )z'
Basic routines to treat verbs
ar_verb
    Nzdata/verbdict.dbc                  2   t           j                                        D ]w} t           j        |          d         }t          j        |          }t          j        |          }|t          v r!t          |                             |            l| gt          |<   xdS )z Create index from the verb dictionary
    to accelerate the search in the dictionary for verbs
    @return: create the TRIVERBTABLE_INDEX
    @rtype: None
    verbN)triverbtableTriVerbTablekeysarabystrip_harakatnormalize_hamzaTRIVERBTABLE_INDEXappend)keyvocverbunvverbnormverbs       O/var/www/html/speakWrite/venv/lib/python3.11/site-packages/libqutrub/verb_db.pycreate_index_triverbtabler   "   s     (--// 3 3+C08%g..(11)))x(//4444,/7x((3 3    Fc                    g }|rt          j        |           }n| }t          j        |          }t                              |          rt          |         D ]}| t
          j        |         d         k    rC|t
          j        |         d         k    r'|                    dt
          j        |                    a|                    t
          j        |                    nt          d           |S )a?  
    Find the triliteral verb in the dictionary (TriVerbTable)
    return a list of possible verb forms
    each item contains:
        - 'root':
        - 'haraka:
        - 'bab':
        - 'transitive':
    @param triverb: given verb.
    @type triverb: unicode.
    @param givenharaka: given haraka of tuture type of the verb, 
    default(FATHA).
    @type givenharaka: unicode.
    @param VocalisedEntree: True if the given verb is vocalized, 
    default False.
    @type VocalisedEntree: Boolean.
    @return: list of triliteral verbs.
    @rtype: list of dicts.
    r   harakar   ztriverb has no verb)
r   r	   r
   r   has_keyr   r   insertr   print)triverbgivenharakavocalised_entreelisteverb_nm
normalizedverb_voc_ids          r   find_alltriverbr    4   s    * E %g..&w//J!!*-- %-j9 	E 	EK,3K@HHHL5kB8LLLQ 9+ FGGGG
 \6{CDDDD	E 	#$$$Lr   c                    g }	 ddl }ddl}|                    t                    }|                                }t          j        |          }|f}	|                    d|	           |D ]y}
|
d         }|
d         }|
d         }|t
          j        t
          j	        fv rd}nd}||k    r!||k    r|
                    d|||d           `|                    |||d           z|                                 |S # t          $ r Y dS w xY w)	a  
    Find the triliteral verb in the dictionary, 
    return a list of possible verb forms
    @param db_base_path: the database path
    @type db_base_path: path string.
    @param triliteralverb: given verb.
    @type triliteralverb: unicode.
    @param givenharaka: given haraka of tuture type of the verb.
    @type givenharaka: unicode.
    @return: list of triliteral verbs.
    @rtype: list of unicode.
    r   Nz{select verb_vocalised, haraka, transitive 
                    from verbdict
                    where verb_unvocalised = ?      TF)r   r   
transitive)sqlite3osconnectdb_pathcursorr   r	   executeKAFMEEMr   r   closeIOError)db_base_pathtriliteralverbr   r   sqliter&   connr)   r   tuprowverb_vocalisedr   r$   s                 r   find_triliteral_verbr6   a   sm    E&    			 ((;;==%n55k 236	8 	8 	8  	; 	;C VNVFQJ
 ei444!

"
 //K64I4IQj!: !: ; ; ; ; ^j: : ; ; ; ;   tts   C4C9 9
DD)__doc__r&   pathjoindirname__file__r(   pyarabic.arabyr   libqutrub.triverbtabler   r   r   FATHAr    r6    r   r   <module>r@      s   ,  
			
',,rwx002D
E
E       - - - - - - 3 3 3$ ,1;) ) ) )Z4 4 4 4 4r   