Skip to content

Commit

Permalink
Modernize naïf -> naive
Browse files Browse the repository at this point in the history
Also add a warning that naïf as a noun is the correct usage.
  • Loading branch information
robinwhittleton committed Nov 4, 2024
1 parent 570a9ac commit f422bbb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion se/spelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def detect_problem_spellings(xhtml: str) -> list:
if regex.search(r"\bfree[\-\s]?will", xhtml):
output.append("“freewill” or “free will” or “free-will” detected. Confirm that “free will” and “free-will” are strictly nouns, and that “freewill” is strictly an adjective.")

if regex.search(r"\bna[iï]f", xhtml):
output.append("“naif” or “naïf” detected. Confirm that “naïf” is strictly a noun, and “naive” is strictly an adjective.")

return output

def modernize_spelling(xhtml: str) -> str:
Expand Down Expand Up @@ -169,7 +172,7 @@ def modernize_spelling(xhtml: str) -> str:
xhtml = regex.sub(r"\b([Mm])enage\b", r"\1énage", xhtml) # menage -> ménage
xhtml = regex.sub(r"([Hh])ypothenuse", r"\1ypotenuse", xhtml) # hypothenuse -> hypotenuse
xhtml = regex.sub(r"[‘’]([Bb])us\b", r"\1us", xhtml) # ’bus -> bus
xhtml = regex.sub(r"([Nn])aïve", r"\1aive", xhtml) # naïve -> naive
xhtml = regex.sub(r"([Nn])a(ïve|ïf|if)", r"\1aive", xhtml) # naïve / naïf / naif -> naive
xhtml = regex.sub(r"([Nn])a[ïi]vet[ée]", r"\1aivete", xhtml) # naïveté -> naivete
xhtml = regex.sub(r"&c\.", r"etc.", xhtml) # &c. -> etc.
xhtml = regex.sub(r"([Pp])rot[ée]g[ée]", r"\1rotégé", xhtml) # protege -> protégé
Expand Down

0 comments on commit f422bbb

Please sign in to comment.