
    kh(                     8    d dl mZmZ d dlmZ  G d de      Zy)    )ABCMetaabstractmethod)DictionaryProbDistc                   Z    e Zd ZdZed
d       Zed        Zd Zd Zed        Z	d Z
d Zy	)ClusterIz<
    Interface covering basic clustering functionality.
    c                      y)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      L/opt/mcp/mcp-sentiment/venv/lib/python3.12/site-packages/nltk/cluster/api.pyclusterzClusterI.cluster           c                      y)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                 .    | j                  |      |k(  ryy)zi
        Returns the likelihood (a float) of the token having the
        corresponding cluster.
        g      ?        )r   )r
   vectorlabels      r   
likelihoodzClusterI.likelihood!   s    
 == E)r   c                     i }d}| j                         D ]  }| j                  ||      ||<   |||   z  }! | j                         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#CK ;w''C	( ))+ 	(G C' 	(!+..r   c                      y)z1
        Returns the number of clusters.
        Nr	   r
   s    r   num_clusterszClusterI.num_clusters9   r   r   c                 F    t        t        | j                                     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      sW        /  
0r   r   )	metaclassN)abcr   r   nltk.probabilityr   r   r	   r   r   <module>r.      s    ( /< <r   