thematic_search.SampleQuery

class thematic_search.SampleQuery(db, indices: ndarray)

A query object carrying a set of document indices. Supports navigation to topics or retrieval of document data.

Typical usage:

topicdb.q.search(“jazz music”).nearby().topics().theme()

__init__(db, indices: ndarray)

Methods

__init__(db, indices)

embeddings()

Return the embedding vectors for these indices.

metadata()

Return the document metadata rows for these indices.

neighbours([k])

Average the embeddings of this SampleQuery's indices, then find the k nearest neighbours.

recursive_theme([z_threshold, ...])

Recursively find a theme formula for these document indices.

strengths(expr)

Return the inclusion strengths of these documents for a cluster expression.

theme()

Find the most surprising topic for these document indices relative to the global corpus, using a KL-divergence-style surprise score.

to_fuzzy()

Use this SampleQuery's indices to filter a FuzzyQuery

topics([threshold, logic])

Return the topics containing these document indices.

unwrap()

where(query)

Filter documents by metadata column values.