surfaceclassificationswitch
Classificationscalar · returns varchar

SWITCH

Semantic pattern matching via specialist zoo NLI (MATCH/YIELD syntax)

Per-row — runs once for each row.

classificationnlispecialist-zootext

Arguments

nametypedescription
textVARCHAR
patternsVARCHAR
yieldsVARCHAR
fallback(optional)VARCHAR

About

Pattern matching with semantic conditions using MATCH/YIELD syntax. Alternative to SEMANTIC_CASE for testing block operators — same underlying semantics. Backend: specialist zoo zero-shot NLI (deberta-v3-large-zeroshot-v2.0) via /classify. All patterns are scored in a single forward pass; the highest-scoring pattern's yield is returned, or the fallback if no pattern clears the uniform baseline. For LLM-style pattern matching with nuanced reasoning, use SEMANTIC_SWITCH_LLM — see semantic_switch_llm.cascade.yaml.

Examples

Semantic SWITCH matches fruit pattern

SELECT
  semantic_switch (
    'apple',
    '["is a fruit", "is an animal"]',
    '["fruit", "animal"]',
    'unknown'
  )

Nearby rabbit holes

same domain
Climb back to The Looking Glass