o
    rZh(                     @   s2   d dl mZmZ d dlmZ G dd dedZdS )    )ABCMetaabstractmethod)DictionaryProbDistc                   @   sV   e Zd ZdZedddZedd Zdd Zd	d
 Zedd Z	dd Z
dd ZdS )ClusterIz<
    Interface covering basic clustering functionality.
    Fc                 C      dS )z
        Assigns the vectors to clusters, learning the clustering parameters
        from the data. Returns a cluster identifier for each vector.
        N )selfZvectorsZassign_clustersr   r   ?/var/www/auris/lib/python3.10/site-packages/nltk/cluster/api.pycluster       zClusterI.clusterc                 C   r   )z
        Classifies the token into a cluster, setting the token's CLUSTER
        parameter to that cluster identifier.
        Nr   )r   tokenr   r   r	   classify   r   zClusterI.classifyc                 C   s   |  ||kr	dS dS )zi
        Returns the likelihood (a float) of the token having the
        corresponding cluster.
        g      ?        )r   )r   vectorlabelr   r   r	   
likelihood!   s   zClusterI.likelihoodc                 C   sX   i }d}|   D ]}| ||||< ||| 7 }q|   D ]
}||  |  < qt|S )z
        Classifies the token into a cluster, returning
        a probability distribution over the cluster identifiers.
        r   )cluster_namesr   r   )r   r   Zlikelihoodssumr
   r   r   r	   classification_probdist+   s   z ClusterI.classification_probdistc                 C   r   )z1
        Returns the number of clusters.
        Nr   r   r   r   r	   num_clusters9   r   zClusterI.num_clustersc                 C   s   t t|  S )zI
        Returns the names of the clusters.
        :rtype: list
        )listranger   r   r   r   r	   r   ?   s   zClusterI.cluster_namesc                 C   s   |S )z<
        Returns the names of the cluster at index.
        r   )r   indexr   r   r	   cluster_nameF   s   zClusterI.cluster_nameN)F)__name__
__module____qualname____doc__r   r
   r   r   r   r   r   r   r   r   r   r	   r      s    


r   )	metaclassN)abcr   r   Znltk.probabilityr   r   r   r   r   r	   <module>   s   