tdfs4ds.agent.values_skill¶
tdfs4ds.agent.values_skill
¶
VALUES skill: the values an entity takes, and the ends of a feature's distribution.
"Give me 5 TICKER values" and "which customers have the highest
sum_Transaction_Amount?" used to reach SUMMARY (the feature list) or an
invented answer. They are now answered by code from in-database reads
(:mod:tdfs4ds.feature_values). No rows leave Teradata beyond the ones shown.
========= ===================================================== ==================
Kind Question Read
========= ===================================================== ==================
entity "give me 5 TICKER values" entity_sample
extremes "which customers have the highest feature_extremes
lookup "feature_values_for
profile "customer 33357", "the features of TICKER NVDA" entity_profile
========= ===================================================== ==================
An entity value is recognised only when the store holds it (one typed-equality query per storage table), never guessed from the wording.
_ENTITY_VALUES_RE
module-attribute
¶
_ENTITY_VALUES_RE = compile('\\b(values?|examples?|samples?|instances?|valeurs?|exemples?|[ée]chantillons?|(?:give|show|list)\\s+(?:me\\s+)?(?:\\d{1,3}|some|a\\s+few|the)|liste[rz]?|donne[sz]?(?:[-\\s]moi)?\\s+(?:\\d{1,3}|des|quelques|les)|montre[sz]?(?:[-\\s]moi)?\\s+(?:\\d{1,3}|des|quelques)|(?:which|what)\\b.*\\b(?:available|exist\\w*|stored|known)|quel(?:le)?s?\\b.*\\b(?:disponibles?|existe\\w*))\\b', IGNORECASE)
_CATALOG_WORDS_RE
module-attribute
¶
_CATALOG_WORDS_RE = compile('\\b(features?|caract[ée]ristiques?|datasets?|jeux?\\s+de\\s+donn[ée]es|process(?:es|us)?|domains?|domaines?|columns?|colonnes?|definitions?|d[ée]finitions?|lineage|lign[ée]e)\\b', IGNORECASE)
_EXTREMES_RE
module-attribute
¶
_EXTREMES_RE = compile('\\b(top|bottom|tail|highest|lowest|largest|smallest|biggest|max(?:imum)?|min(?:imum)?|outliers?|extremes?|extr[êe]mes?|anomal\\w*|unusual|atypiques?|aberrant\\w*|plus\\s+(?:grand|[ée]lev[ée]|petit|faible|bas|haut)\\w*|distribution|r[ée]partition)\\b', IGNORECASE)
_NOT_LOOKUP_RE
module-attribute
¶
_NOT_LOOKUP_RE = compile('\\b(mean(?:s|ing)?|definitions?|define|signifi\\w*|veut\\s+dire|formula|formule|comput\\w*|calcul\\w*|lineage|lign[ée]e|depend\\w*|fresh\\w*|up\\s+to\\s+date|[àa]\\s+jour|derni[eè]re\\s+mise)\\b', IGNORECASE)
_STOP_WORDS
module-attribute
¶
_STOP_WORDS = {'THE', 'A', 'AN', 'OF', 'FOR', 'IN', 'ON', 'AT', 'TO', 'IS', 'ARE', 'WHAT', 'WHICH', 'WHO', 'HOW', 'AND', 'OR', 'ME', 'MY', 'GIVE', 'SHOW', 'TELL', 'ABOUT', 'VALUE', 'VALUES', 'FEATURE', 'FEATURES', 'PLEASE', 'IT', 'ITS', 'THIS', 'THAT', 'THESE', 'BY', 'WITH', 'ALL', 'LE', 'LA', 'LES', 'DE', 'DES', 'DU', 'POUR', 'EST', 'SONT', 'QUEL', 'QUELLE', 'QUELS', 'QUELLES', 'VALEUR', 'VALEURS', 'DONNE', 'MOI', 'MONTRE', 'ET', 'OU', 'UN', 'UNE', 'AU', 'AUX'}
_value_tokens
¶
Words of the question that could be entity values (the store decides).
_entity_in
¶
The entity the question names, exactly or in plain words (one only).
_lookup_target
¶
The entity of the named features whose stored values include tokens.
values_request
¶
The kind of values question asked (see the module docstring), or None.
Read from the store of the turn: names and values are never guessed.
complete_pending
¶
The choice a reply makes among the offered (domain, entity) pairs: a
number, or words naming the entity / the domain. None when it names none.
skill_values
¶
skill_values(question: str, object_name: Optional[str] = None, entity_name: Optional[str] = None, data_domain: Optional[str] = None, as_of=None, pending: Optional[dict] = None) -> dict
Answer a VALUES question (direct answer, written by code). pending is the question this skill asked last turn ("which one?"): the reply chooses.
_loosely_named
¶
The question speaks of the entity in plain words: every key column, without
an id / key / code suffix and as a word stem ("customers" for
CustomerID, "categories" for Category).
_feature_target
¶
{"entity", "domain"} for the one stored feature the turn means, or
{"choices": [rows]} when it stays ambiguous (never guessed).
extremes_lines
¶
The extremes of a feature as Markdown lines (also appended to a distribution chart).
render_lookup
¶
Values of named features for given entity values: one table.
render_profile
¶
Every feature of given entity values: one table per value.