
    -it                         d Z ddlmZmZmZmZ ddlZddlZddlZddl	Z
ddlZdZddlmZ ddlZ G d dej        j                  Zd Zedk    r e             dS dS )	z^
Arabic Dictionary Class from Arramooz Al Waseet.
Used in multiporpus morpholigical treatment
    )absolute_importprint_functionunicode_literalsdivisionNzdata/custom_dictionary.sqlitec                       e Zd ZdZefdZdS )custom_dictionaryz
    Arabic dictionary Class customized, used to add new words before add them to arramooz project.
    It's used to add new entries manually to this dictionary by user,
    In order to improve lately Arramooz project.
    c                    t           j        j                            | |           t	          t
          d          rt
          j        }nAt          j        	                    t          j        
                    t                              }t          j                            ||          }t          j                            |          rq	 t          j        |          | _        t          j        | j        _        | j                                        | _        dS # t(          $ r t+          d|           Y dS w xY wt+          d                    d|dt          j        g                              d                     dS )zv
        initialisation of dictionary from a data dictionary, create indexes
        to speed up the access.

        frozenz(Fatal Error Can't find the database file zInexistant Filez current dir utf8N)arramoozarabicdictionaryArabicDictionary__init__hasattrsysprefixospathdirnamerealpath__file__joinexistssqliteconnect
db_connectRowrow_factorycursorIOErrorprintcurdirencode)self
table_namefilename_dbbase	file_paths        W/var/www/html/speakWrite/venv/lib/python3.11/site-packages/qalsadi/custom_dictionary.pyr   zcustom_dictionary.__init__*   sH    	!2;;D*MMM 3!! 	?:DD7??27#3#3H#=#=>>DGLL{33	7>>)$$ 	M"(.";";.4j+"o4466 M M M@)LLLLLLM &	?BIN &..    s   	AD D65D6N)__name__
__module____qualname____doc__FILE_DBr        r*   r   r   #   s7          07      r1   r   c                  f   t          d          } g d}g }|D ]U}|                     |          }|D ];}t          |          }|d         }|                    t          |                     <Vt	          t          |                              dd                              d                     dS )z
    main test
    verbs)u   استقلّu
   استقلu   كذب	vocalizedz},z},
zunicode-escapeN)r   lookupdictappendr"   reprreplacedecode)mydictwordlisttmp_listword	foundlist
word_tupler4   s          r*   mainlyrA   L   s    
 w''F777HH . .MM$''	# 	. 	.Jj))J";/IOOD,,----	. 
$x..
 
 v
.
.
5
56F
G
GHHHHHr1   __main__)r.   
__future__r   r   r   r   rer   os.pathsqlite3r   r   r/   pyarabic.arabyarabyarramooz.arabicdictionaryr   r   r   r   rA   r+   r0   r1   r*   <module>rJ      s               
			             




)              % % % % %1B % % %RI I I" z
FHHHHH r1   