orthonym.validation.pin_spelling#
Note
Internal API. Names and behaviour may change between releases.
Spelling checks of a pin_verified name, independent of the round trip.
A round trip proves the molecule, never the spelling: OPSIN reads pyrido[1,2-b]pyridazin-6-one
and even 9H-pyrido[1,2-b]pyridazin-6-one back to the same structure as the PIN
6H-pyrido[1,2-b]pyridazin-6-one. The label pin_verified also claims that the spelling is
the Blue Book PIN form. Each check here decides one spelling rule from two inputs only: the
structure (an RDKit Mol) and the name read lexically. A check never calls the engine’s naming
code or OPSIN, so it cannot inherit a defect of the code that built the name.
Interface (binding for every lane that adds a check):
*SpellingFailure – rule (the Blue Book rule id the name breaks) and detail.
*register() – @register("") on a function fn(mol, name) -> SpellingFailure | None.
Several functions may share one rule id. A function returns a failure only when it has decided that the name breaks its rule; pass and abstain (a name or structure the reader cannot read with certainty) both return None.
*check_pin_spelling() – every registered check on (mol, name); the list of failures.
The built-in checks live in the modules of:data:BUILTIN_CHECK_MODULES, imported on first use. A lane adds a check by adding its module there.
The caller (Orthonym._tier_row_and_pin_form) runs the checks on a name it would label
pin_verified; a non-empty result lowers the label (the default tier then declines the name,
the wider tiers keep it as systematic_verified) and never changes the name.
- class orthonym.validation.pin_spelling.SpellingFailure(rule, detail)#
Bases:
objectA name breaks the Blue Book rule
rule(for example"");detailsays how.- rule: str#
- detail: str#
- orthonym.validation.pin_spelling.BUILTIN_CHECK_MODULES = ('orthonym.validation.spelling.checks_ring_prefix', 'orthonym.validation.spelling.checks_hydrogen', 'orthonym.validation.spelling.checks_marks', 'orthonym.validation.spelling.checks_locants', 'orthonym.validation.spelling.checks_parent', 'orthonym.validation.spelling.checks_phane', 'orthonym.validation.spelling.checks_assembly', 'orthonym.validation.spelling.checks_prefixes', 'orthonym.validation.spelling.checks_pseudohalide', 'orthonym.validation.spelling.checks_one_carbon_parent', 'orthonym.validation.spelling.checks_heterone', 'orthonym.validation.spelling.checks_placement', 'orthonym.validation.spelling.checks_identical_prefixes', 'orthonym.validation.spelling.checks_thioperoxol', 'orthonym.validation.spelling.checks_amine_parent', 'orthonym.validation.spelling.checks_group_count')#
modules whose import registers the built-in checks
- orthonym.validation.pin_spelling.register(rule_id)#
Decorator: register
fn(mol, name) -> SpellingFailure | Noneunderrule_id.
- orthonym.validation.pin_spelling.registered_rules()#
The rule ids that have at least one check.
- orthonym.validation.pin_spelling.check_pin_spelling(mol, name, *, strict=False)#
Every registered check on
(mol, name): the list of:class:SpellingFailure.A check that raises is a defect of the check, not of the name: it is logged and counts as an abstention, so a reader bug can never lower a label by itself.
strict=Truere-raises instead (the validation runs and the tests use it, so a crash is seen there). Without a structure or a name there is nothing to check, and no check module is loaded.