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

**`class DocJoinFilter(config)`**

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

The doc_join [`Filter`](squirro.lib.nlp.steps.filters.Filter.md#squirro.lib.nlp.steps.filters.Filter) joins multiple [`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document) into one [`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document) via id or a specified field.

**Note** - This step assumes the fields arrive in a pre-sorted state, so that when the value of the join_field (if specified) changes, a new [`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document) is created.
Fields from subsequent Documents with the same join_field will be appended until the join_field changes again.

**Input** - No specific input fields type required.

**Output** - The output field type is going to be of type [`list`](https://docs.python.org/3.11/library/stdtypes.html#list) [ input field type ].

Parameters

- `type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – doc_join
- `fields` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`, ``[``]`) – Fields to join
- `join_field` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``'id'`) – Field to join on

**Example**

```json
{
    "step": "filter",
    "type": "doc_join",
    "fields":["sentences"]
}
```

Methods SummaryMethods Documentation

**`process(docs)`**

Process a set of documents

Parameters

`docs` (`generator``(`[`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)`)`) – Generator of documents

Returns

Generator of processed documents

Return type

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

**`train(docs)`**

Train on a step of a set of documents

Parameters

`docs` (`generator``(`[`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)`)`) – Generator of documents

Returns

Generator of processed documents

Return type

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