B
    >?ð[N  ã               @   sD   d dl mZmZ d dlmZ d dlmZ eeƒG dd„ deƒƒZdS )é    )ÚABCMetaÚabstractmethod)Úadd_metaclass)Ú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   ú/lib/python3.7/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      ð?g        N)r   )r   ÚvectorZlabelr   r   r	   Ú
likelihood#   s    zClusterI.likelihoodc             C   s`   i }d}x,|   ¡ D ] }|  ||¡||< ||| 7 }qW x |   ¡ D ]}||  |  < q@W t|ƒS )z
        Classifies the token into a cluster, returning
        a probability distribution over the cluster identifiers.
        g        )Ú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_clusters;   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   A   s    zClusterI.cluster_namesc             C   s   |S )z<
        Returns the names of the cluster at index.
        r   )r   Úindexr   r   r	   Úcluster_nameH   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   N)	Úabcr   r   Zsixr   Znltk.probabilityr   Úobjectr   r   r   r   r	   Ú<module>	   s   