surfaceextractionextract
Extractionscalar · returns varchar

EXTRACT

Extract specific information from unstructured text (zero-shot NER)

Per-row — runs once for each row.

extractionnlispecialist-zootext

Syntax

{{ text }} EXTRACTS '{{ what }}'

Arguments

nametypedescription
textVARCHAR
whatVARCHARWhat to extract (e.g., 'product name', 'complaint type')
threshold(optional)DOUBLE

About

Semantic information extraction — pulls specific facts, entities, or details from unstructured text. Like grep but with semantic understanding. Backend: specialist zoo GLiNER (urchade/gliner_large-v2.1) via the /extract route. GLiNER is a zero-shot NER model trained to accept arbitrary descriptive entity labels (e.g., "customer name", "price mentioned", "order number"), not just canonical NER types. The user's `what` argument is passed directly as a label and we return the highest-scoring matching span's text. Use cases: - Extract product names from reviews - Pull dates / amounts from emails - Find key entities in support tickets - Grab specific facts from documents Returns NULL if the requested information isn't present in the text (or if GLiNER's confidence is below the threshold). For LLM-style extraction with contextual interpretation (e.g., the answer isn't an exact span but needs synthesis), use EXTRACTS_LLM — see extracts_llm.cascade.yaml.

Examples

Function: Price extracted

SELECT
  semantic_extract ('The price is $49.99 per unit', 'price')

Function: Email extracted

SELECT
  semantic_extract ('Contact John Smith at john@company.com', 'email')

Function: Order number extracted

SELECT
  semantic_extract (
    'Order shipped ref 12345 on Monday',
    'order number'
  )

Infix EXTRACTS: time extracted from text

WITH
  t AS (
    SELECT
      'Meeting with CEO scheduled for 3pm' AS msg
  )
SELECT
  msg EXTRACTS 'time'
FROM
  t

Infix EXTRACTS: product name extracted

WITH
  t AS (
    SELECT
      'Product: iPhone 15 Pro Max - great camera!' AS review
  )
SELECT
  review EXTRACTS 'product name'
FROM
  t

Nearby rabbit holes

same domain
Climb back to The Looking Glass