a
     ˜ëj(  ã                   @   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   s   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   úO/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/nltk/cluster/api.pyÚcluster   s    zClusterI.clusterc                 C   s   dS )z€
        Classifies the token into a cluster, setting the token's CLUSTER
        parameter to that cluster identifier.
        Nr   )r   Útokenr   r   r   Úclassify   s    zClusterI.classifyc                 C   s   |   |¡|krdS dS dS )zi
        Returns the likelihood (a float) of the token having the
        corresponding cluster.
        g      ð?ç        N)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   s   dS )z1
        Returns the number of clusters.
        Nr   ©r   r   r   r   Únum_clusters9   s    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   