Skip to contents

Renames the primary identifier column of a dictionary to term, providing a consistent interface across dictionaries that use different column naming conventions. This is a non-destructive transformation: the original column is kept and a term column is added.

Usage

unify_dictionary(name, ...)

Arguments

name

Character or data frame. Dictionary name (e.g., "global_surnames") or a data frame to unify directly.

...

Additional arguments passed to load_dictionary (ignored when name is a data frame).

Value

A data frame with a term column added.

Details

The following renaming rules are applied (first match wins):

  • name -> term (us_ssa_names, us_ssa_surnames, etc.)

  • word -> term (english_prepositions, english_adverbs, etc.)

  • place -> term (english_place_names, demonyms)

  • callsign -> term (callsigns)

  • disease -> term (diseases)

  • surname -> term (global_surnames)

  • form -> term (english_normalization_rules, english_abbreviations, unicode_normalization, etc.)

  • interjection -> term (english_interjections)

  • marker -> term (english_discourse_markers)

  • latin -> term (latin_phrases)

  • emoticon -> term (english_emoticons)

  • color_name -> term (english_colors)

  • infinitive -> term (english_irregular_verbs)

If the dictionary already has a term column or none of the recognized columns are found, the dictionary is returned unchanged.

See also

load_dictionary for loading dictionaries, list_dictionaries for available dictionaries.

Examples

if (FALSE) { # \dontrun{
# Load and unify column names
surnames <- unify_dictionary("global_surnames")
head(surnames$term)  # "term" column added from "surname"

# Already-unified dictionary is returned as-is
sens <- unify_dictionary("sensorimotor")
head(sens$term)  # already has "term" column

# Pass a data frame directly
df <- load_dictionary("english_numerics")
unified <- unify_dictionary(df)
head(unified$term)
} # }