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

**`class EmailParseNormalizer(config)`**

Bases: [`Normalizer`](squirro.lib.nlp.steps.normalizers.Normalizer.md#squirro.lib.nlp.steps.normalizers.Normalizer)

The email parse [`Normalizer`](squirro.lib.nlp.steps.normalizers.Normalizer.md#squirro.lib.nlp.steps.normalizers.Normalizer) parses an string which is based on a email to extract the email body. More in detail:

1. Find a regex match “Body:” in the non-html email string.
2. Extract body using python email parser.
3. Given a list as discard_footers (e.g. [“Best regards”, “Warm Regards”]), discard the body after first appearance of a footer string.

**Input** - all input fields need to be of type [`str`](https://docs.python.org/3.11/library/stdtypes.html#str). Example:

```text
From: Squirro\nTo: Hi,\nI hope to find you well. In the emails before you've learned more about our Insights Engine.\nBest regards, Squirro
```

**Output** - all output fields are filled with data of type [`str`](https://docs.python.org/3.11/library/stdtypes.html#str). Example:

```text
I hope to find you well. In the emails before you've learned more about our Insights Engine.
```

Parameters

- `type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – email_parse
- `discard_footers` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)) – Discard the text after occurrence of these footer strings.

**Example**

```json
{
    "step": "normalizer",
    "type": "email_parse",
    "input_fields": ["email"],
    "output_fields": ["parsed_email"],
    "discard_footers": ["Best regards", "Warm Regards"]
}
```

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)
