
    g                     .    d dl Z d dlmZ  G d de      Zy)    N)StemmerIc                   $    e Zd ZdZddZd Zd Zy)RegexpStemmera  
    A stemmer that uses regular expressions to identify morphological
    affixes.  Any substrings that match the regular expressions will
    be removed.

        >>> from nltk.stem import RegexpStemmer
        >>> st = RegexpStemmer('ing$|s$|e$|able$', min=4)
        >>> st.stem('cars')
        'car'
        >>> st.stem('mass')
        'mas'
        >>> st.stem('was')
        'was'
        >>> st.stem('bee')
        'bee'
        >>> st.stem('compute')
        'comput'
        >>> st.stem('advisable')
        'advis'

    :type regexp: str or regexp
    :param regexp: The regular expression that should be used to
        identify morphological affixes.
    :type min: int
    :param min: The minimum length of string to stem
    c                 b    t        |d      st        j                  |      }|| _        || _        y )Npattern)hasattrrecompile_regexp_min)selfregexpmins      E/var/www/openai/venv/lib/python3.12/site-packages/nltk/stem/regexp.py__init__zRegexpStemmer.__init__*   s(    vy)ZZ'F	    c                 n    t        |      | j                  k  r|S | j                  j                  d|      S )N )lenr   r   sub)r   words     r   stemzRegexpStemmer.stem0   s.    t9tyy K<<##B--r   c                 6    d| j                   j                  dS )Nz<RegexpStemmer: >)r   r   )r   s    r   __repr__zRegexpStemmer.__repr__6   s    !$,,"6"6!9;;r   N)r   )__name__
__module____qualname____doc__r   r   r    r   r   r   r      s    6.<r   r   )r	   nltk.stem.apir   r   r    r   r   <module>r"      s    
 ")<H )<r   