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

**`class TermsExtractionEmbedder(config)`**

Bases: [`Embedder`](squirro.lib.nlp.steps.embedders.Embedder.md#squirro.lib.nlp.steps.embedders.Embedder)

The term extraction [`Embedder`](squirro.lib.nlp.steps.embedders.Embedder.md#squirro.lib.nlp.steps.embedders.Embedder) allows to extract significant terms provided textual data.

**Note** - the significant terms get extracted based on tf/idf. There is some text cleaning, html removal, stopword removal, noun chunking, lemmatization etc. done prior to the extraction.

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

**Output** - the output field is 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) ].

Parameters

- `type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – terms_extraction
- `input_field` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`, ``[``]`) – list of fields to embed from
- `filter_list` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`, ``[``]`) – extra words to added to the stopword list
- `max_content_length` ([`int`](https://docs.python.org/3.11/library/functions.html#int)`, ``50000`) – maximum document length to be processed - longer documents are cut off
- `min_word_len` ([`int`](https://docs.python.org/3.11/library/functions.html#int)) – minimal word length
- `max_chunk_len` ([`int`](https://docs.python.org/3.11/library/functions.html#int)) – max chunk length
- `max_cores` ([`int`](https://docs.python.org/3.11/library/functions.html#int)`, ``-1`) – max number of cpu cores used
- `save_model` ([`bool`](https://docs.python.org/3.11/library/functions.html#bool)) – save the tf-idf model
- `cache_lemmas` ([`bool`](https://docs.python.org/3.11/library/functions.html#bool)) – cache the lemmatized words
- `p_significant_terms` ([`float`](https://docs.python.org/3.11/library/functions.html#float)) – % of significant term to be extracted
- `add_lemmization` ([`bool`](https://docs.python.org/3.11/library/functions.html#bool)) – lemmatize input text

**Example**

```json
{
    "step": "embedder",
    "type": "terms_extraction",
    "input_field": ["text"],
    "output_field": "significant_terms",
    "max_chunk_len": 2,
    "min_word_len": 4,
    "p_significant_terms": 0.2,
    "add_lemmization": false,
    "cache_lemmas": false,
    "save_model": false
}
```

Methods SummaryMethods Documentation

**`process_batch(batch)`**

Process a batch of documents. If not defined will default to using
self.process_doc for each document in the batch.

Parameters

`batch` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`(`[`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)`)`) – List of documents

Returns

List of processed documents

Return type

[list](https://docs.python.org/3.11/library/stdtypes.html#list)([Document](../technical/libnlp/base.md#squirro.lib.nlp.document.Document))
