Skip to content

Should a conjunction inside a hyphenated surname keep its lowercase? Ortega-y-Gasset now capitalizes to Ortega-Y-Gasset #478

Description

@derek73

capitalize() on a hyphenated compound surname now uppercases a conjunction inside it. Measured on the released wheels and on the 2.2 branch, all with force=True:

input 1.4.0 2.0.0 2.1.0 2.2
jose ortega-y-gasset Jose Ortega-y-Gasset Jose Ortega-y-Gasset Jose Ortega-y-Gasset Jose Ortega-Y-Gasset
JOSE ORTEGA-Y-GASSET Jose Ortega-Y-Gasset Jose Ortega-Y-Gasset Jose Ortega-Y-Gasset Jose Ortega-Y-Gasset

The two spellings disagreed on every version through 2.1. #458 made them agree — by taking the uppercase answer, which is a deviation from 1.4.0 for the lowercase spelling. The same applies to Silva-e-Sousa, -et-, -und- and every other member of Lexicon.conjunctions.

Why it happens

#458 moved the conjunction-or-initial decision into the parse, and the decision is the whole token's. Ortega-y-Gasset is one family token carrying no conjunction tag, so repair capitalizes each word of it.

The spaced spelling is unaffected and still reads the convention correctly — there y is a token of its own and is tagged conjunction:

parse("jose ortega y gasset")   # family "ortega y gasset", the `y` tagged conjunction
# capitalize() -> "Jose Ortega y Gasset"   (unchanged on every version)

The case for leaving it

A hyphenated token is one word to the parser, and re-deciding per sub-word inside a token is exactly what #458 removed — it was producing two answers for one name. Reintroducing a sub-word rule for conjunctions only would be a narrower version of the thing that was wrong.

The case for changing it

Ortega-y-Gasset is a real orthography with a real convention, and the hyphenated spelling is common in library catalogues and bibliographies. The library gets the spaced form right, so a user reasonably expects the hyphenated form to match. Today the two spellings of one name repair differently.

Scope, measured

  • The parse is unaffected. Ortega-y-Gasset is a single family token before and after; only capitalized() differs.
  • 0 of 1,103 differential corpus names have a conjunction inside a hyphenated token, and compare.py never calls capitalized() anyway (decisions.md#R4), so no gate run can see this either way.
  • No safe workaround today. A capitalization_exceptions key of ortega-y-gasset never matches — keys are looked up per word. A 'y' -> 'y' entry does restore it, but breaks initials: y. smith repairs to y Smith.

Found while replacing the constructed e-f example in 2.2's release note with a real name (#477).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions