This PR implements everything about name disambiguation.
38 out of 67 disambiguation tests now pass. The rest are implicit year-suffixes attached to dates, and other semi-related features like cite collapsing, citation labels, and bibliographies; none of the disambiguation failure diffs relate to names!
How it works for given name expansion
Cites produce a NameIR that contains enough info to recompute one name variable in a names block.
The spec requires adding given names that disambiguate within a "set of ambiguous cites". Recall that in citeproc-rs' approach, this is nonsensical. We use the "set of references that could have produced this cite" instead. So this process needs to assume that all those references came from the same names block for each reference. Pretty safe, in general, unless you're dealing with, e.g., book titles that are also names. The spec just doesn't accommodate those at all. At least we'll possibly be able to run AddYearSuffix/Conditional disambiguation.
Using those references, we pull out the RefNameIR that would have matched the NameIR in question. Then each is split into a series of slots, where a slot contains a list of names from the same position across all the matching references.
Then we run according to spec; for each name from the cite, ratchet it according to the givenname-disambiguation-rule, save the progress if it makes that name match fewer ref-names in the same slot.
The saved progress in the NameIRs is flushed, i.e. the cite's IR is modified to reflect the progress.
Example:
Two matching refs had [{Jones | B. Jones | Bernie Jones}] and [{Jones | A. Jones | Andy Jones}] respectively. The first is our cite's proper/own reference. The cite is initially [Jones]. There is only one slot. For that slot, it initially matches two refs. It ratchets to [B. Jones], and now matches only one. It's done, so it saves the change and the change gets flushed out to the IR.
This PR implements everything about name disambiguation.
38 out of 67 disambiguation tests now pass. The rest are implicit year-suffixes attached to dates, and other semi-related features like cite collapsing, citation labels, and bibliographies; none of the disambiguation failure diffs relate to names!
How it works for given name expansion
citeproc-rs
' approach, this is nonsensical. We use the "set of references that could have produced this cite" instead. So this process needs to assume that all those references came from the same names block for each reference. Pretty safe, in general, unless you're dealing with, e.g., book titles that are also names. The spec just doesn't accommodate those at all. At least we'll possibly be able to run AddYearSuffix/Conditional disambiguation.Example:
Two matching refs had
[{Jones | B. Jones | Bernie Jones}]
and[{Jones | A. Jones | Andy Jones}]
respectively. The first is our cite's proper/own reference. The cite is initially [Jones]. There is only one slot. For that slot, it initially matches two refs. It ratchets to [B. Jones], and now matches only one. It's done, so it saves the change and the change gets flushed out to the IR.