> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphext.com/llms.txt
> Use this file to discover all available pages before exploring further.

# extract_text_features

> Parse and process texts to extract multiple features at once. 

Essentially combines all of the following steps into one:

* `embed_text`
* `extract_emoji`
* `extract_entities`
* `extract_hashtags`
* `extract_keywords`
* `extract_mentions`
* `infer_sentiment`
* `tokenize`

Note that the step does not currently allow for detailed configuration of each of the extracted features.
To do that, use any or all of the individual steps above.

## Usage

The following examples show how the step can be used in a recipe.

<Accordion title="Examples" icon="code" defaultOpen="true">
  <Tabs>
    <Tab title="Example 1">
      Extract all text features with automatic language detection

      ```stan theme={null}
      extract_text_features(ds.text) => (ds.sentiment, ds.embedding, ds.hashtags, ds.mentions, ds.keywords, ds.tokens, ds.emoji, ds.people, ds.groups, ds.organizations, ds.gpes, ds.locations, ds.products, ds.events, ds.money)
      ```
    </Tab>

    <Tab title="Example 2">
      Extract text features providing a language column

      ```stan theme={null}
      extract_text_features(ds.text, ds.language) => (ds.sentiment, ds.embedding, ds.hashtags, ds.mentions, ds.keywords, ds.tokens, ds.emoji, ds.people, ds.groups, ds.organizations, ds.gpes, ds.locations, ds.products, ds.events, ds.money)
      ```
    </Tab>

    <Tab title="Signature">
      General syntax for using the step in a recipe. Shows the inputs and outputs the step is expected to receive and will produce respectively. For futher details see sections below.

      ```stan theme={null}
      extract_text_features(text: text, *lang: category, {
          "param": value,
          ...
      }) -> (
      	Sentiment: number,
      	Embedding: list[number],
      	Hashtags: list[category],
      	Mentions: list[category],
      	Keywords: list[category],
      	Tokens: list[category],
      	Emoji: list[category],
      	People: list[category],
      	Groups: list[category],
      	Organizatons: list[category],
      	GPEs: list[category],
      	Locations: list[category],
      	Products: list[category],
      	Events: list[category],
      	Money: list[category]
      )
      ```
    </Tab>
  </Tabs>
</Accordion>

## Inputs & Outputs

The following are the inputs expected by the step and the outputs it produces. These are generally
columns (`ds.first_name`), datasets (`ds` or `ds[["first_name", "last_name"]]`) or models (referenced
by name e.g. `"churn-clf"`).

<Accordion title="Inputs" icon="right-to-bracket">
  <ParamField path="text" type="column[text]" required>
    A text column to extract n-grams from.
  </ParamField>

  <ParamField path="*lang" type="column[category]">
    An (optional) column identifying the languages of the corresponding texts. It is used to identify the correct model (spaCy)
    to use for each text. If the dataset doesn't contain such a column yet, it can be created using the `infer_language` step.
    Ideally, languages should be expressed as two-letter
    [ISO 639-1 language codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes), such as "en", "es" or "de" for
    English, Spanish or German respectively. We also detect fully spelled out names such as "english", "German", "allemande"
    etc., but it is not guaranteed that we will recognize all possible spellings correctly always, so ISO codes should be
    preferred.

    Alternatively, if all texts are in the same language, it can be identified with the `lang` *parameter* instead.
  </ParamField>
</Accordion>

<Accordion title="Outputs" icon="right-from-bracket">
  <ParamField path="Sentiment" type="column[number]" required />

  <ParamField path="Embedding" type="column[list[number]]" required />

  <ParamField path="Hashtags" type="column[list[category]]" required />

  <ParamField path="Mentions" type="column[list[category]]" required />

  <ParamField path="Keywords" type="column[list[category]]" required />

  <ParamField path="Tokens" type="column[list[category]]" required />

  <ParamField path="Emoji" type="column[list[category]]" required />

  <ParamField path="People" type="column[list[category]]" required />

  <ParamField path="Groups" type="column[list[category]]" required />

  <ParamField path="Organizatons" type="column[list[category]]" required />

  <ParamField path="GPEs" type="column[list[category]]" required />

  <ParamField path="Locations" type="column[list[category]]" required />

  <ParamField path="Products" type="column[list[category]]" required />

  <ParamField path="Events" type="column[list[category]]" required />

  <ParamField path="Money" type="column[list[category]]" required />
</Accordion>

## Configuration

The following parameters can be used to configure the behaviour of the step by including them in
a json object as the last "input" to the step, i.e. `step(..., {"param": "value", ...}) -> (output)`.

<Accordion title="Parameters" defaultOpen="true" icon="sliders">
  This step doesn't expect any specific parameters.
</Accordion>
