o
    i
                     @   s<   d dl mZmZ ddlmZ ddlmZ G dd deZdS )    )ListTuple   )
Lemmatizer)Tokenc                       sf   e Zd Zededeee ee f f fddZdedee fddZ	dedee fdd	Z
  ZS )
DutchLemmatizermodereturnc                    s$   |dkrg d}|g fS t  |S )Nrule)lemma_lookuplemma_rules	lemma_exclemma_index)superget_lookups_config)clsr   required	__class__ L/home/ubuntu/.local/lib/python3.10/site-packages/spacy/lang/nl/lemmatizer.pyr      s   z"DutchLemmatizer.get_lookups_configtokenc                 C   s&   | j di }|j }|||gS )zOverrides parent method so that a lowercased version of the string
        is used to search the lookup table. This is necessary because our
        lookup table consists entirely of lowercase keys.r   )lookups	get_tabletextlowerget)selfr   lookup_tablestringr   r   r   lookup_lemmatize   s   
z DutchLemmatizer.lookup_lemmatizec                 C   sz  |j |jf}|| jv r| j| S |j}|j  }|dv r(|  g}|| j|< |S | jdi }| jdi }| jdi }||i }	||i }
||i }|  }|dvra|g}|| j|< |S ||i }||v ru|g}|| j|< |S | jdi }||i }
z|
| d g}|| j|< |W S  ty   Y nw | jdi }||}|r||v r|g}|| j|< |S | jdi }g }|D ]/\}}|	|r|d t
|t
|  | }|sq||	v r|g}|| j|< |  S || qtt|}|r&|D ]}||
v r|g}|| j|< |  S q|r|g}|| j|< |S || j|< |S |r3|g}|| j|< |S |g}|| j|< |S )N) eolspacer   r   r   )	nounverbauxadjadvprondetadpnumr   r   )r   poscacher   pos_r   r   r   KeyErrorendswithlenappendlistdictfromkeys)r   r   	cache_keyr   univ_posformsindex_table	exc_tablerules_tableindex
exceptionsrulesr   r   looked_up_lemma	oov_formsoldnewformr   r   r   rule_lemmatize   s   


















zDutchLemmatizer.rule_lemmatize)__name__
__module____qualname__classmethodstrr   r   r   r   r    rE   __classcell__r   r   r   r   r      s
    (	r   N)typingr   r   pipeliner   tokensr   r   r   r   r   r   <module>   s    