CosineSimilarityClassifier

class squirro.lib.nlp.steps.classifiers.CosineSimilarityClassifier(config)

Bases: squirro.lib.nlp.steps.classifiers.Classifier

Classifier which uses the cosine similarity to classify.

Parameters

type (str) – cosine_similarity

Methods Summary

load()

Load a step

process(docs)

Process a set of documents

process_batch(batch)

Process a batch of documents.

save()

Save a step

train(docs)

Train on a step of a set of documents

Methods Documentation

load()

Load a step

process(docs)

Process a set of documents

Parameters

docs (generator(Document)) – Generator of documents

Returns

Generator of processed documents

Return type

generator(Document)

process_batch(batch)

Process a batch of documents. If not defined will default to using self.process_doc for each document in the batch.

Parameters

batch (list(Document)) – List of documents

Returns

List of processed documents

Return type

list(Document)

save()

Save a step

train(docs)

Train on a step of a set of documents

Parameters

docs (generator(Document)) – Generator of documents

Returns

Generator of processed documents

Return type

generator(Document)