VoteFilter

class squirro.lib.nlp.steps.filters.VoteFilter(config)

Bases: squirro.lib.nlp.steps.filters.Filter

The vote Filter assigns a single value by majority vote from a list of values (e.g. [["positive"],["negative"],["positive"]] -> ["positive"], ["positive", "negative", "negative"]  -> ["negative"]). It picks the first element of the list, in case of a tie.

Input - all input fields need to be of type list [str] or list [ list [str]].

Output - all output fields are filled with data of type list [ str ] (the list contains only a single element).

Parameters
  • field (str, None) – Field to vote

  • fields (list, None) – List of fields to vote

  • input_fields (list, None) – List of fields to vote from

  • output_fields (list, None) – List of fields to vote to

Example

{
    "step": "filter",
    "type": "vote",
    "fields": ["prediction"]
}

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