Skip to main content
A “mention”, i.e. a reference to a user or account, here simply means any word starting with the ”@” character. The step generates a new column with one list of mentions for each original text (row).

Usage

The following example shows how the step can be used in a recipe.

Examples

  • Example 1
  • Signature
Without configuring the languages to be processed simply use the following code. Otherwise see parameters below.
extract_mentions(ds.text, ds.lang) -> (ds.mentions)

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").
text
column[text]
required
A text column to extract mentions from.
*lang
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, 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 language parameter instead.
mentions
column[list[category]]
required
A column of lists containing the mentions extracted from the texts.

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).

Parameters

extended_language_support
boolean
default:"false"
Whether to enable support for additional languages. By default, Arabic (“ar”), Catalan (“ca”), Basque (“eu”), and Turkish (“tu”) are not enabled, since they’re supported only by a different class of language models (stanfordNLP’s Stanza) that is much slower than the rest. This parameter can be used to enable them.
min_language_freq
[number, integer]
default:"0.02"
Minimum number (or proportion) of texts to include a language in processing. Any texts in a language with fewer documents than these will be ignored. Can be useful to speed up processing when there is noise in the input languages, and when ignoring languages with a small number of documents only is acceptable. Values smaller than 1 will be interpreted as a proportion of all texts, and values greater than or equal to 1 as an absolute number of documents.
  • number
  • integer
{_}
number
number.Values must be in the following range:
0 < {_} < 1
language
[string, null]
The language of inputs texts. If all texts are in the same language, it can be specified here instead of passing it as an input column. The language will be used to identify the correct spaCy model to parse and analyze the texts. For allowed values, see the comment regarding the lang column above.
I