orthonym.assembly.identical_prefixes#
Note
Internal API. Names and behaviour may change between releases.
Identical substituent prefixes of one scope are cited once, with a multiplying prefix.
“MULTIPLICATIVE PREFIXES ‘DI’, ‘TRI’, ETC. vs. ‘BIS’, ‘TRIS’, ETC.” (the Blue Book), (:7027): “Multiplicative prefixes… are the principal method for describing a
multiplicity of identical features of a structure in chemical names.” The locants of the group
are cited together whatever their kind: “Lowest set of locants” (:3189), “Italic capital
and lower-case letter locants are lower than Greek letter locants, which, in turn, are lower than
numerals” (:3195), so the italic N is cited before the numerals, and (:3448) “multiplicative
prefixes, if necessary, are then inserted and do not alter the alphabetical order already
established”. Preferred names that cite them so: N,4-dimethyl-N-(3-methylphenyl)benzamide (PIN)
(:32879), N,N,2-trimethyl-3-{...}propanamide (PIN) (:21624), N,N,N,1-tetramethylquinolin-1-ium-
3-aminium (PIN) (:42213).
A producer that cites the prefixes of the parent from several sources (the characteristic-group
loop, the substituent walk, the N-substituents of an amine or an amide) used to put the
sources side by side, so 2-methyl and N-methyl stood in one name and the parent read
2-(4-methoxyphenyl)-2-methyl-N-methylpropanamide. This module is the one place that
combines them. Its input is either the parts of the prefixes (name and locants,
shared_prefix_entries()) or the rendered prefixes (group_identical_prefixes());
a rendered prefix is read back into its parts and used only when the engine’s own writer of a
multiplied component, naming_utils.multiplied_component, writes the very same text from
them, so a prefix the reader does not fully understand is left as it was. Nothing is cut out
of a finished name: the combined prefix is written again from its parts, and the set of
(locant, substituent name) pairs of the input is the set of the output.
- orthonym.assembly.identical_prefixes.cited_locants(locants)#
locantsas strings in the order they are cited in a group, the Blue Book: italic letters before numerals;prefix_locant_order_key).
- orthonym.assembly.identical_prefixes.read_prefix(text)#
text(‘N-methyl’, ‘2,3-dihydroxy’, ‘2-(4-methoxyphenyl)’) read into its locants and substituent;Noneunlessmultiplied_componentwrites exactlytextfrom them. Two readings that disagree on the name are no reading.
- orthonym.assembly.identical_prefixes.write_prefix(name, marked, locants)#
The prefix that cites
locants(as they are cited in a group) in front of the substituentnamewritten with the marksmarked.
- orthonym.assembly.identical_prefixes.group_identical_prefixes(prefixes, *, sort=True)#
The rendered prefixes of one parent with every substituent that is cited twice or more combined into one multiplied prefix, locants N-first (
['2-methyl', 'N-methyl']gives['N,2-dimethyl']), in the order of whensort(the order the callers give a list of rendered prefixes,prefix_citation_sort_keywithparent_locants).A prefix the reader does not understand, one without locants, and a substituent whose two citations are the very same text (one group an earlier step listed twice, not two substituents) are left alone.
The substituents the ring and the nitrogens of an amine both carry, as multiplied prefixes.
ring_groupsmaps a substituent name to its locants on the ring andn_groupsmaps a name to the locants of the nitrogens that carry it (tagturns one of them into the text that is cited: ‘N’, or ‘N1’ from the superscript 1). A name in both is cited once, the italic N locants first (4-methylanilinewith a methyl on the nitrogen,N,4-dimethylaniline); the grouping iscomposition_primitives.combine_identical_prefix_groups.Returns
(ring_groups, n_groups, entries): the two inputs without the shared names andentries, the(alphanumerical key, rendered prefix)pairs of the shared ones.
shared_prefix_groups()for an aniline, whose nitrogen carries the substituentsn_names(one name per substituent, a name that occurs twice sits twice on the nitrogen). Returns(ring_groups, n_names, entries).
- orthonym.assembly.identical_prefixes.split_prefix_zone(name)#
(prefixes, parent)of a chain-amide name whose prefixes all cite locants:'2-{...}-3,3-dimethylbutanamide'gives(['2-{...}', '3,3-dimethyl'], 'butanamide').Nonefor a name of any other shape, or when a prefix is not one the engine’s writer of a multiplied component writes from its parts (read_prefix).
- orthonym.assembly.identical_prefixes.merge_n_block_into_name(n_block, name)#
name(a chain amide that cites prefixes of its own) with the N-substituents ofn_block(‘N-methyl’, ‘N,N-diethyl’, ‘N-ethyl-N-methyl’) cited with them: where a substituent is cited in both, the group is one multiplied prefix, and the prefixes are in the order of (‘N-methyl’ in front of ‘3,3-dimethylbutanamide’ gives ‘N,3,3-trimethylbutanamide’).Nonewhen no substituent is shared, or when either text is not read with certainty; the caller then writes the block in front as before.The result is audited: the (locant, substituent) pairs of the two texts are exactly those of the result.