Step 05 - Standardize spelling
step-05-standardize-spelling.RmdThe dictionary-driven layer. standardize_spelling() applies fix_spelling() to every title, which in turn calls ~50 small fix_* routines to expand abbreviations and unify variants, then condenses unambiguous C-suite forms.
standardize_spelling()
+- fix_spelling()
+- fix_vice(), fix_executive(), fix_director(), fix_president(), ... (~50 fix_* routines)
+- condense_abbreviations(), simplify_clevels()
+- remove_trailing_conjunctions(), fix_of()
+- spellcheck() (hunspell)
Examples
fix_spelling("VP") # VICE PRESIDENT
#> [1] "VICE PRESIDENT"
fix_spelling("SR D MARKETING") # SENIOR DIRECTOR OF MARKETING
#> [1] "SENIOR DIRECTOR OF MARKETING"
fix_spelling("SECY") # SECRETARY
#> [1] "SECRETARY"
fix_spelling("TRTEE") # TRUSTEE
#> [1] "TRUSTEE"An implicit “of” is inserted before a recognized subject:
fix_spelling("VICE PRESIDENT FINANCE") # VICE PRESIDENT OF FINANCE
#> [1] "VICE PRESIDENT OF FINANCE"Unambiguous C-suite forms are condensed; ambiguous ones are left expanded. (Note: EXECUTIVE DIRECTOR is normalized here but mapped to CEO later, by the step 07 crosswalk.)
fix_spelling("CHIEF EXEC OFFICER") # CEO
#> [1] "CEO"
fix_spelling("CHIEF FINANCIAL OFFICER") # CFO
#> [1] "CFO"
fix_spelling("CHIEF ADVANCEMENT OFFICER") # unchanged (no standard abbreviation)
#> [1] "CHIEF ADVANCEMENT OFFICER"Individual routines can be called directly — useful when refining rules:
fix_vice(c("EVP", "SVP", "V.P."))
#> [1] "EXECUTIVE VICE PRESIDENT" "SENIOR VICE PRESIDENT"
#> [3] "V.P."Input: TitleTxt4. Output: TitleTxt5, spelling-normalized. Continue with step 06.