orthonym.validation.format_validator#

Note

Internal API. Names and behaviour may change between releases.

OPSIN format validation for generated IUPAC names.

: Heuristic validator that detects known OPSIN-incompatible patterns. : Bracket nesting verification hierarchy). : Multi-word name validation against OPSIN’s 21 wordRules.xml patterns.

This is a DIAGNOSTIC tool, not a postprocessor. It flags known issues so upstream fixes can be applied at the root cause.

orthonym.validation.format_validator.validate_name_format(name)#

Validate an IUPAC name for known OPSIN-incompatible patterns.

This is a diagnostic heuristic validator . It checks for patterns known to cause OPSIN parse failures. It is NOT a full OPSIN parser reimplementation.

Parameters:

name (str) – Generated IUPAC name string.

Returns:

Tuple of (is_valid, reason). If valid, returns (True, “ok”). If invalid, returns (False, “reason_code: details”).

Return type:

Tuple[bool, str]

Checks performed:
  1. Empty name

  2. Unbalanced brackets (parentheses, square brackets, braces)

  3. Empty parentheses

  4. Bare ‘oxy’ prefix (not part of a larger word)

  5. Double hyphens – (except within VB descriptors)

  6. Multi-word name validation against OPSIN word rules

  7. Bracket nesting hierarchy verification