orthonym.decomposition.engine#

Note

Internal API. Names and behaviour may change between releases.

Decomposition engine with quality gating and orchestration.

The engine decides WHETHER to decompose a molecule (quality gate), calls bond_cleavage and fragment_capping to split it, names each fragment recursively, and assembles the final multi-component name.

Quality gate prevents regressions: molecules that the existing pipeline names correctly are left alone. Only molecules with poor names (unknown, suspiciously short, etc.) are decomposed.

orthonym.decomposition.engine.nacyl_float_refusing()#

True inside a refusal scope (_NACYL_FLOAT_REFUSALS); a memo-key component.

orthonym.decomposition.engine.gate_nonsuffix_nacyl_float(amine_smiles, float_name, amine_name=None)#

Decision A gate for a bare N-<acyl> float (the amide branch of _try_single_bond_decompose and fragment_assembly._assemble_amide).

Returns float_name unchanged when the acylated N is a suffix nitrogen (_nacyl_float_n_is_suffix_nitrogen). Otherwise, inside a refusal scope the float is withheld (None) so that a systematic name can be built; outside one it ships as an honest demotion: validated as before, but recorded as a non-PIN fragment, so name_tiered labels any name that carries it below pin_verified.

orthonym.decomposition.engine.try_decompose(mol, style='pin')#

Attempt decomposition of a molecule into named fragments.

This is the main entry point for the decomposition engine. It: 1. Finds cleavable bonds (ester, amide, phosphodiester, thioester,

glycosidic, sulfonamide, carbamate, ether – 8 types)

  1. Checks if the existing pipeline name is acceptable (quality gate)

  2. Selects the best bond to cleave

  3. Cleaves and caps the fragments

  4. Names each fragment recursively

  5. Assembles the multi-component IUPAC name

Returns None if: - No cleavable bonds exist - The existing pipeline name is good enough (quality gate passes) - Fragment naming fails - Size guard detects non-shrinking fragments

Parameters:
  • mol – RDKit Mol object to decompose.

  • style (str) – Naming style (“pin” for preferred IUPAC names).

Returns:

Multi-component IUPAC name string, or None to fall through to the existing naming pipeline.

Return type:

str | None