SmartfilterClassifier#

class SmartfilterClassifier(config)#

Bases: Classifier

The smartfilter Classifier uses the Elastic Search based highlight tags <squirro:highlight> and </squirro:highlight> to classify text fragments.

Note - The squirro.lib.nlp.steps.loaders.SquirroQueryLoader step needs to be run before this step, further make sure that search highlighting is switched on. It works with normal search queries and smartfilters.

Input - all input fields need to be of type str.

Output - the output field is filled with data of type str. It contains the extract which is encapsulated by the highlight tags. the lable_field is filled with the smartfilter_label.

Parameters:
  • type (str) – smartfilter

  • words_threshold (int, 1) – Minimum number of highlighted words to be included as an extract.

  • smartfilter_label (str) – Label added to document if it contains an extract.

Example

{
  "step": "classifier",
  "type": "smartfilter",
  "input_field": "body",
  "output_field": "extract",
  "smartfilter_label": "classA",
  "label_field": "label"
}

Methods Summary

process_doc(doc)

Process a document

Methods Documentation

process_doc(doc)#

Process a document

Parameters:

doc (Document) – Document

Returns:

Processed document

Return type:

Document