<!-- Source: https://docs.squirro.com/en/latest/api/squirro.lib.nlp.steps.filters.VoteFilter.html -->
# VoteFilter

**`class VoteFilter(config)`**

Bases: [`Filter`](squirro.lib.nlp.steps.filters.Filter.md#squirro.lib.nlp.steps.filters.Filter)

The vote [`Filter`](squirro.lib.nlp.steps.filters.Filter.md#squirro.lib.nlp.steps.filters.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`](https://docs.python.org/3.11/library/stdtypes.html#list) [[`str`](https://docs.python.org/3.11/library/stdtypes.html#str)] or [`list`](https://docs.python.org/3.11/library/stdtypes.html#list) [ [`list`](https://docs.python.org/3.11/library/stdtypes.html#list) [[`str`](https://docs.python.org/3.11/library/stdtypes.html#str)]].

**Output** - all output fields are filled with data of type [`list`](https://docs.python.org/3.11/library/stdtypes.html#list) [ [`str`](https://docs.python.org/3.11/library/stdtypes.html#str) ] (the [`list`](https://docs.python.org/3.11/library/stdtypes.html#list) contains only a single element).

Parameters

- `field` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``None`) – Field to vote
- `fields` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`, ``None`) – List of fields to vote
- `input_fields` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`, ``None`) – List of fields to vote from
- `output_fields` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`, ``None`) – List of fields to vote to

**Example**

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

Methods SummaryMethods Documentation

**`process_doc(doc)`**

Process a document

Parameters

`doc` ([`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)) – Document

Returns

Processed document

Return type

[Document](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)
