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_KINDS order.

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_key of every word no stand-in may be.

Parameters:

Notes

Developer notes. Build one with surrogate_set_from_document or load_surrogate_set; the constructor does not validate, and the identity is only meaningful when it was computed from the content.

avoid: frozenset = frozenset({})#
avoids(candidate)[source]#

Return whether candidate is one of the set’s avoided words.

Parameters:
candidatestr

A proposed stand-in, from this set or from the built-in names.

Returns:
bool

True when its word_key is listed under avoid.

Parameters:

candidate (str)

Return type:

bool

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 for kind.

Parameters:
kindstr

The placeholder category.

indexint

Zero-based position in this kind’s sequence.

Returns:
str or None

A candidate, or None when the set does not define kind (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.md section 6). Two lists are combined with the same offset rule as the built-in names, so consecutive people do not share a surname.

capacity(kind)[source]#

Return how many distinct stand-ins this set can propose for kind.

Parameters:

kind (str)

Return type:

int

identity: str[source]#
kinds()[source]#

Return the kinds this set defines.

Return type:

tuple[str, …]

name: str[source]#
pools: tuple[tuple[str, tuple[tuple[str, ...], ...]], ...][source]#
source: str = '<memory>'#
summary: str[source]#
version: int[source]#