SurrogateSet#
- class scikitplot.cleanprompt.SurrogateSet(name, version, summary, pools, identity, source='<memory>', avoid=frozenset({}))[source]#
A validated set of invented names.
- Parameters:
- namestr
Set name: lower case, starts with a letter, at most 32 characters.
- versionint
The set’s own version; bump it when entries change meaning.
- summarystr
One line saying what the set is for.
- poolstuple of (str, tuple of tuple of str)
Each kind with its lists, in
SETTABLE_KINDSorder.- identitystr
name@version#digest16— what a vault and a plan record.- sourcestr, default=’<memory>’
Where it was loaded from. Not part of equality.
- avoidfrozenset of str, default=frozenset()
word_keyof every word no stand-in may be.
- Parameters:
Notes
Developer notes. Build one with
surrogate_set_from_documentorload_surrogate_set; the constructor does not validate, and the identity is only meaningful when it was computed from the content.- avoids(candidate)[source]#
Return whether
candidateis one of the set’s avoided words.- Parameters:
- candidatestr
A proposed stand-in, from this set or from the built-in names.
- Returns:
- bool
Truewhen itsword_keyis listed underavoid.
- Parameters:
candidate (str)
- Return type:
Notes
Developer notes. Called by the core loop (
surrogate_for) on every candidate, so the rule holds for two-part names, which are only formed at run time, and for the built-in names of kinds the set leaves out. A provider without this method avoids nothing.
- candidate(kind, index)[source]#
Propose the
index-th stand-in forkind.- Parameters:
- kindstr
The placeholder category.
- indexint
Zero-based position in this kind’s sequence.
- Returns:
- str or None
A candidate, or
Nonewhen the set does not definekind(the core then uses its built-in names).
- Parameters:
- Return type:
str | None
Notes
Developer notes. Only a proposal: the core decides whether it is used (
GENERATOR_DESIGN.mdsection 6). Two lists are combined with the same offset rule as the built-in names, so consecutive people do not share a surname.