Classify()
Classify this text against ARBITRARY candidate labels with no training: rank each label by how closely its MEANING matches the text (embedding cosine when a model is loaded, else lexical). Pass richer label strings (e.g. "about sports") for sharper separation. Classify(labels) -- ranked [label, score] pairs, most similar first (DATA).
also written: ClassificationOf
Basic examples (1)
t = new stzText("the stock market prices fell sharply on wall street today")
# ClassifiedAs picks the closest label
? t.ClassifiedAs([ "market finance", "cooking food" ])
# Classify returns ranked [label, score] pairs, best first
? t.Classify([ "market finance", "cooking food" ])[1][1]
# Classify keeps all labels
? len(t.Classify([ "market finance", "cooking food", "space travel" ]))
# ClassifyQ is the basic stzList
? classname(t.ClassifyQ([ "a", "b" ]))
# ClassifyQQ is stzListOfPairs
? classname(t.ClassifyQQ([ "a", "b" ]))
# a non-list of labels is rejected
? @@(t.Classify("not a list"))market finance market finance 3 stzlist stzlistofpairs [ ]
run on 2026-10-02 04:23 inside the library at commit 0e72e2e2c; taken from text_query_layer_narrated.ring(opens in a new tab)
The extensions of this method
Each extension, and whether it exists for this method; an extension that exists combines with the others (FindSTCS).
Every example is a test file of the library, run inside the library for this page; only those whose output kept every promise their file wrote are shown.
See also
- The class stzText
- The area's reference: NLP & linguistics
- The other methods in these examples: stzText.ClassifiedAs

