tdfs4ds.agent.entity_word¶
tdfs4ds.agent.entity_word
¶
The word "entity" as a business term (0.3.7.34, pure).
tdfs4ds says "entity" for the key a feature is computed for (CustomerID, AccountID). In some
stores - banking is the usual one - "entity" is a business word: a legal entity of the group,
often a column (LEGAL_ENTITY, ENTITY_ID). :func:entity_word_is_business says which
meaning the store carries; :func:decide_entity_reading says what "entity X" in a question
refers to when it does. No database access here: the caller reads the inputs once per turn.
_ENTITY_TERMS
module-attribute
¶
_ENTITY_TERMS = frozenset({'ENTITY', 'ENTITIES', 'LEGAL ENTITY', 'LEGAL ENTITIES', 'ENTITE', 'ENTITES', 'ENTITE JURIDIQUE', 'ENTITES JURIDIQUES'})
_PHRASE_RE
module-attribute
¶
_PHRASE_RE = re.compile('\\b(?:legal\\s+)?(?:entity|entities|entit[eé]s?)(?:\\s+juridiques?)?\\s+(?:(?:named|called|nomm[ée]e?s?)\\s+)?[\\"\'`]?([\\w][\\w.\\-]*)', re.IGNORECASE | re.UNICODE)
_FILLER
module-attribute
¶
_FILLER = frozenset({'for', 'of', 'the', 'is', 'are', 'and', 'or', 'in', 'on', 'with', 'has', 'have', 'key', 'keys', 'level', 'levels', 'a', 'an', 'to', 'by', 'that', 'which', 'what', 'as', 'at', 'from', 'do', 'does', 'did', 'list', 'available', 'exist', 'exists', 'existing', 'registered', 'defined', 'there', 'here', 'all', 'disponibles', 'existent', 'les', 'des', 'de', 'du', 'la', 'le', 'pour', 'est', 'sont', 'et', 'ou', 'dans', 'avec', 'cle', 'clef', 'cles', 'niveau', 'niveaux', 'un', 'une', 'qui', 'que', 'quoi', 'au', 'aux', 'sur', 'par', 'comme'})
glossary_defines_entity
¶
True when the glossary defines ENTITY, LEGAL ENTITY, ENTITE or ENTITE JURIDIQUE (term or synonym).
business_entity_columns
¶
The documented column / feature names carrying ENTITY (or ENTITE) that are not themselves a key of the store (the tdfs4ds concept), in first-seen order.
entity_word_is_business
¶
entity_word_is_business(glossary_entries, column_names: Iterable, entity_keys: Iterable = ()) -> bool
True when "entity" is a business term in this store: the glossary defines it, or a documented column / feature name contains ENTITY without being the key of the store.
entity_phrase
¶
X of "entity X" / "legal entity X" / "entité X" in question, or None (a filler word is no X).
decide_entity_reading
¶
decide_entity_reading(question: str, entity_keys: Iterable, known_names: Iterable, columns: Iterable, value_found: Optional[Callable[[str, str], bool]] = None) -> Optional[Dict]
What "entity X" refers to when the word is a business term.
None when the question has no "entity X". Otherwise a dict with action:
key (X names a key of the store: the tdfs4ds concept, unchanged), object (X is a feature or
documented object), value (X is a value of column) or ask (still ambiguous: the agent asks).
clarification_text
¶
The fixed question asked when "entity X" is ambiguous.
clarification_options
¶
legal_question
¶
The fixed search question that shows where the value of a business entity is documented.
value_note
¶
First line of the answer when X is a value of a business entity column (not a key).
not_a_key_text
¶
Answer when the reader chose the "feature key" reading but X is not a key of the store.