
    zIfr                     @    d dl mZmZ d dlmZ  G d de          ZdS )    )ABCMetaabstractmethod)DictionaryProbDistc                   n    e Zd ZdZedd            Zed             Zd Zd Zed             Z	d Z
d	 Zd
S )ClusterIz<
    Interface covering basic clustering functionality.
    Fc                     dS )z
        Assigns the vectors to clusters, learning the clustering parameters
        from the data. Returns a cluster identifier for each vector.
        N )selfvectorsassign_clusterss      D/var/www/piapp/venv/lib/python3.11/site-packages/nltk/cluster/api.pyclusterzClusterI.cluster             c                     dS )z
        Classifies the token into a cluster, setting the token's CLUSTER
        parameter to that cluster identifier.
        Nr	   )r
   tokens     r   classifyzClusterI.classify   r   r   c                 <    |                      |          |k    rdS dS )zi
        Returns the likelihood (a float) of the token having the
        corresponding cluster.
        g      ?        )r   )r
   vectorlabels      r   
likelihoodzClusterI.likelihood!   s%    
 ==  E))33r   c                     i }d}|                                  D ]&}|                     ||          ||<   |||         z  }'|                                  D ]}||xx         |z  cc<   t          |          S )z
        Classifies the token into a cluster, returning
        a probability distribution over the cluster identifiers.
        r   )cluster_namesr   r   )r
   r   likelihoodssumr   s        r   classification_probdistz ClusterI.classification_probdist+   s    
 ))++ 	( 	(G#'??67#C#CK ;w''CC))++ 	( 	(G   C'    !+...r   c                     dS )z1
        Returns the number of clusters.
        Nr	   r
   s    r   num_clusterszClusterI.num_clusters9   r   r   c                 ^    t          t          |                                                     S )zI
        Returns the names of the clusters.
        :rtype: list
        )listranger    r   s    r   r   zClusterI.cluster_names?   s&    
 E$++--..///r   c                     |S )z<
        Returns the names of the cluster at index.
        r	   )r
   indexs     r   cluster_namezClusterI.cluster_nameF   s	     r   N)F)__name__
__module____qualname____doc__r   r   r   r   r   r    r   r&   r	   r   r   r   r      s             ^   ^  / / /   ^
0 0 0    r   r   )	metaclassN)abcr   r   nltk.probabilityr   r   r	   r   r   <module>r.      sj    ( ' ' ' ' ' ' ' / / / / / /< < < < < < < < < < <r   