Skip to content

Label texts containing from query

NLP ยท text

Label texts given a query of the form "word1 ; word2 OR word3".

Example

label_texts_containing_from_query(ds.text, {"query": "startup OR entrepreneur; marketing OR -digital; devops"}) -> (ds.field_of_occupation)

Usage

The following are the step's expected inputs and outputs and their specific types.

label_texts_containing_from_query(text_col: text, {"param": value}) -> (labels: list[category])

where the object {"param": value} is optional in most cases and if present may contain any of the parameters described in the corresponding section below.

Inputs


text_col: column:text

A text column to label.

Outputs


labels: column:list[category]

A column containing the labels assigned to each text.

Parameters


query: string

Query to label. Query is a string of labels/categories and associated keywords (see examples below). Use ";" to separate categories, "OR" to join words for a category, and "-" to exclude words from a category. The category label(s) will be formed using the query, e.g. a text containing "AA" and "BB" will be tagged as [AA,BB].

Example parameter values:

  • "Cristiano OR -Five; for"