
    NgN                     ,    d dl mZ  G d d          ZdS )    )defaultdictc                   <    e Zd ZdZddZd ZddZddZd	 Zd
 Z	dS )
MinimalSeta  
    Find contexts where more than one possible target value can
    appear.  E.g. if targets are word-initial letters, and contexts
    are the remainders of words, then we would like to find cases like
    "fat" vs "cat", and "training" vs "draining".  If targets are
    parts-of-speech and contexts are words, then we would like to find
    cases like wind (noun) 'air in rapid motion', vs wind (verb)
    'coil, wrap'.
    Nc                     t                      | _        t                      | _        t          t                     | _        i | _        |r |D ]\  }}}|                     |||           dS dS )z
        Create a new minimal set.

        :param parameters: The (context, target, display) tuples for the item
        :type parameters: list(tuple(str, str, str))
        N)set_targets	_contextsr   _seen	_displaysadd)self
parameterscontexttargetdisplays        P/var/www/html/ai-engine/env/lib/python3.11/site-packages/nltk/misc/minimalset.py__init__zMinimalSet.__init__   s{      %%
 	3,6 3 3(&'2222	3 	33 3    c                     | j         |                             |           | j                            |           | j                            |           || j        ||f<   dS )a  
        Add a new item to the minimal set, having the specified
        context, target, and display form.

        :param context: The context in which the item of interest appears
        :type context: str
        :param target: The item of interest
        :type target: str
        :param display: The information to be reported for each item
        :type display: str
        N)r
   r   r	   r   r   )r   r   r   r   s       r   r   zMinimalSet.add&   sf     	
7''' 	7###&!!! -4()))r      c                 .      fd j         D             S )z
        Determine which contexts occurred with enough distinct targets.

        :param minimum: the minimum number of distinct target forms
        :type minimum: int
        :rtype: list
        c                 P    g | ]"}t          j        |                   k     |#S  )lenr
   ).0cminimumr   s     r   
<listcomp>z'MinimalSet.contexts.<locals>.<listcomp>D   s1    KKKaSA-?-?7-J-J-J-J-Jr   )r	   )r   r   s   ``r   contextszMinimalSet.contexts<   s&     LKKKK4>KKKKr    c                 :    ||f| j         v r| j         ||f         S |S N)r   )r   r   r   defaults       r   r   zMinimalSet.displayF   s+    V..>7F"344Nr   c                 x    g }| j         D ]/}|                     ||          }|r|                    |           0|S r"   )r   r   append)r   r   resultr   xs        r   display_allzMinimalSet.display_allL   sK    m 	! 	!FWf--A !a   r   c                     | j         S r"   )r   )r   s    r   targetszMinimalSet.targetsT   s
    }r   r"   )r   )r    )
__name__
__module____qualname____doc__r   r   r   r   r(   r*   r   r   r   r   r      s         3 3 3 3 4 4 4,L L L L         r   r   N)collectionsr   r   r   r   r   <module>r0      sU    $ # # # # #J J J J J J J J J Jr   