nltk.cluster.api module

class nltk.cluster.api.ClusterI[source]

Bases: object

Interface covering basic clustering functionality.

classification_probdist(vector)[source]

Classifies the token into a cluster, returning a probability distribution over the cluster identifiers.

abstract classify(token)[source]

Classifies the token into a cluster, setting the token’s CLUSTER parameter to that cluster identifier.

abstract cluster(vectors, assign_clusters=False)[source]

Assigns the vectors to clusters, learning the clustering parameters from the data. Returns a cluster identifier for each vector.

cluster_name(index)[source]

Returns the names of the cluster at index.

cluster_names()[source]

Returns the names of the clusters. :rtype: list

likelihood(vector, label)[source]

Returns the likelihood (a float) of the token having the corresponding cluster.

abstract num_clusters()[source]

Returns the number of clusters.