ó
ù`]c           @   s\   d  d l  m Z m Z d  d l m Z d  d l m Z e e ƒ d e f d „  ƒ  Yƒ Z d S(   iÿÿÿÿ(   t   ABCMetat   abstractmethod(   t   add_metaclass(   t   DictionaryProbDistt   ClusterIc           B   sb   e  Z d  Z e e d „ ƒ Z e d „  ƒ Z d „  Z d „  Z e d „  ƒ Z	 d „  Z
 d „  Z RS(   s<   
    Interface covering basic clustering functionality.
    c         C   s   d S(   sš   
        Assigns the vectors to clusters, learning the clustering parameters
        from the data. Returns a cluster identifier for each vector.
        N(    (   t   selft   vectorst   assign_clusters(    (    s/   lib/python2.7/site-packages/nltk/cluster/api.pyt   cluster   t    c         C   s   d S(   s€   
        Classifies the token into a cluster, setting the token's CLUSTER
        parameter to that cluster identifier.
        N(    (   R   t   token(    (    s/   lib/python2.7/site-packages/nltk/cluster/api.pyt   classify   R	   c         C   s!   |  j  | ƒ | k r d Sd Sd S(   si   
        Returns the likelihood (a float) of the token having the
        corresponding cluster.
        g      ð?g        N(   R   (   R   t   vectort   label(    (    s/   lib/python2.7/site-packages/nltk/cluster/api.pyt
   likelihood#   s    c         C   sx   i  } d } x8 |  j  ƒ  D]* } |  j | | ƒ | | <| | | 7} q Wx$ |  j  ƒ  D] } | | c | :<qT Wt | ƒ S(   s   
        Classifies the token into a cluster, returning
        a probability distribution over the cluster identifiers.
        g        (   t   cluster_namesR   R   (   R   R   t   likelihoodst   sumR   (    (    s/   lib/python2.7/site-packages/nltk/cluster/api.pyt   classification_probdist-   s    c         C   s   d S(   s1   
        Returns the number of clusters.
        N(    (   R   (    (    s/   lib/python2.7/site-packages/nltk/cluster/api.pyt   num_clusters;   R	   c         C   s   t  t |  j ƒ  ƒ ƒ S(   sI   
        Returns the names of the clusters.
        :rtype: list
        (   t   listt   rangeR   (   R   (    (    s/   lib/python2.7/site-packages/nltk/cluster/api.pyR   A   s    c         C   s   | S(   s<   
        Returns the names of the cluster at index.
        (    (   R   t   index(    (    s/   lib/python2.7/site-packages/nltk/cluster/api.pyt   cluster_nameH   s    (   t   __name__t
   __module__t   __doc__R   t   FalseR   R   R   R   R   R   R   (    (    (    s/   lib/python2.7/site-packages/nltk/cluster/api.pyR      s   	
		N(	   t   abcR    R   t   sixR   t   nltk.probabilityR   t   objectR   (    (    (    s/   lib/python2.7/site-packages/nltk/cluster/api.pyt   <module>	   s   