Skip to content

tdfs4ds.agent.inventory_answers

tdfs4ds.agent.inventory_answers

Inventory answers written by code (0.3.7.34): the entities of the store, and the datasets a question names by their name words or entity columns.

Both read the turn's catalogs through consumer_agent (imported lazily: the package rebinds the name tdfs4ds.agent.consumer_agent to the function) and are fail-open: an unreadable catalog gives an empty result, never an exception.

_FILLER module-attribute

_FILLER = frozenset({'dataset', 'datasets', 'data', 'id', 'ids', 'dealing', 'deal', 'deals', 'available', 'exist', 'exists', 'existing', 'registered', 'feature', 'features', 'store', 'use', 'used', 'using', 'contain', 'contains', 'find', 'where', 'there', 'any', 'some', 'table', 'tables', 'view', 'views', 'entity', 'entities', 'number', 'numbers', 'related', 'about', 'jeu', 'jeux', 'donnees', 'données', 'quel', 'quels', 'quelle', 'quelles', 'existe', 'trouver', 'peut', 'puis', 'dans', 'les', 'des', 'une', 'est', 'sont'})

_ca

_ca()

_stem

_stem(w: str) -> str

_stems

_stems(text: str, drop: frozenset = frozenset()) -> set

question_stems

question_stems(question: str) -> set

match_datasets

match_datasets(question: str, datasets: list, descriptions: dict = None) -> list

The datasets whose name, entity columns or description share content words with question, best first. datasets are _dataset_rows() rows. Pure.

Words are compared by stem (plural, -ing / -ed / -n: "drawn" ~ "drawing"), underscores split. With two matching words or more only the datasets matching the most words are kept; with one, every dataset matching it.

dataset_matches

dataset_matches(question: str, limit: int = 8) -> list

Search matches ({name, type, justification}) for datasets a question names by words of their name, entity columns or description. Fail-open: [].

entity_inventory

entity_inventory(question: str = '') -> dict

{status: 'entity_list', entities: [{entity, domain, n_features, description}], answer}.

The entities are the (data domain, entity key) pairs of the feature catalog; the description is the entity description stored with the processes that compute its features (the most frequent non-empty one). Written by code, EN/FR.