Package {SemNetDictionaries}


Title: Dictionaries for the 'SemNetCleaner' Package
Version: 0.3.0
Date: 2026-10-14
Maintainer: Alexander P. Christensen <alexpaulchristensen@gmail.com>
Description: Implements dictionaries that can be used in the 'SemNetCleaner' package. Also includes several functions aimed at facilitating the text cleaning analysis in the 'SemNetCleaner' package. This package is designed to integrate and update word lists and dictionaries based on each user's individual needs by allowing users to store and save their own dictionaries. Dictionaries can be added to the 'SemNetDictionaries' package by submitting user-defined dictionaries to https://github.com/AlexChristensen/SemNetDictionaries.
Depends: R (≥ 3.6.0)
Imports: utils
License: GPL (≥ 3.0)
Suggests: htmlTable, knitr, rmarkdown, tcltk, testthat (≥ 3.0.0), withr
URL: https://github.com/AlexChristensen/SemNetDictionaries
BugReports: https://github.com/AlexChristensen/SemNetDictionaries/issues
NeedsCompilation: no
Encoding: UTF-8
LazyData: true
VignetteBuilder: knitr
Config/testthat/edition: 3
Config/roxygen2/version: 8.1.1
Packaged: 2026-10-14 20:26:46 UTC; alextops
Author: Alexander P. Christensen ORCID iD [aut, cre]
Repository: CRAN
Date/Publication: 2026-10-14 22:12:21 UTC

SemNetDictionaries–package

Description

Implements dictionaries that can be used in the SemNetCleaner-package. Also includes several functions aimed at facilitating the text cleaning analysis in the SemNetCleaner-package. This package is designed to integrate and update word lists and dictionaries based on each user's individual needs by allowing users to store and save their own dictionaries. Dictionaries can be added to the SemNetDictionaries package by submitting user-defined dictionaries to https://github.com/AlexChristensen/SemNetDictionaries.

Author(s)

Alexander Christensen <alexpaulchristensen@gmail.com>

See Also

Useful links:


Animals Dictionary

Description

A database of possible animals responses (n = 1285)

Usage

data(animals.dictionary)

Format

animals.dictionary (vector, length = 1285)

Details

To add additional animals to the dictionary, please make an appendix dictionary (append.dictionary)

Examples

data("animals.dictionary")

Animals Moniker

Description

A database of possible animals monikers and common spelling errors

Usage

data(animals.moniker)

Format

animals.moniker (list, length = 340)

Details

To add additional animals monikers to the database, please submit a pull request or issue to https://github.com/AlexChristensen/SemNetDictionaries

Examples

data("animals.moniker")

Appendix Dictionary

Description

A function designed to create post-hoc dictionaries in the SemNetDictionaries package. This allows for new semantic categories or word lists to be saved for future use (i.e., your own personal dictionary). Dictionaries created using this function can either be saved as an R object to your global environment or as a .rds file on your current computer. Open-source community-derived dictionaries can be uploaded to and downloaded from https://github.com/AlexChristensen/SemNetDictionaries

Usage

append.dictionary(
  ...,
  dictionary.name = "appendix",
  save.location = c("envir", "wd", "choose", "path"),
  path = NULL,
  textcleaner = FALSE,
  package = FALSE
)

Arguments

...

Character vector. A vector of words to create or add to a dictionary

dictionary.name

Character. Name of dictionary to create or add words to. Defaults to "appendix". Input a name to create or add to an existing dictionary. This function with automatically name files with the "*.dictionary.rds" suffix

save.location

Character. A choice for where to store appendix dictionary. Defaults to "envir".

  • "envir": Returns dictionary as a vector object to R's global environment

  • "wd": Saves dictionary to working directory. Useful for storing dictionaries alongside projects

  • "choose": User chooses a directory for more permanent storage. This will allow you to use this dictionary in the future

  • "path": User specifies a path to a directory if it is already known. This will allow direct updates to the directory and bypass the prompts in the save/update menus. This will also allow you to use this dictionary in the future

path

Character. A path to an existing directory. Only necessary for save.location = "path"

textcleaner

Boolean. Argument for skipping asking to save the dictionary twice. Defaults to FALSE. If TRUE, then asking to save the dictionary will be skipped. The existing dictionary is the argument in ... whose expression contains "dictionary" (e.g., full_dictionary); if there is none, it is all arguments after the first one. Everything else is treated as new words. When the dictionary file already exists, only the new words are added to it. The words of the dictionary argument that the file does not have are not saved, which gives a warning of class "semnet_dictionary_words_not_saved"

package

Boolean. Defunct. It was used to update the package's own dictionaries and is no longer available

Details

Words are added to a dictionary that is already sorted, unique, and lower case (such as the vector returned by a previous call) without sorting the dictionary again, which makes adding words one at a time fast.

Appendix dictionaries are useful for storing spelling definitions that are not available in the SemNetDictionaries package. This function enables the storage of personalized dictionaries, which can be used in combination with other dictionaries to facilitate the cleaning of text data.

Dictionaries are either stored in R's global environment, where they will be deleted once R is closed (unless you save them), or in a directory you choose. A menu will pop-up asking whether you would like to save or update your dictionary. You have two options:

To save your dictionary file, you can either:

Note that save.location = "choose" and save.location = "path" will automatically update your dictionary if there is a file with the same name enter into the dictionary.name argument.

To find where your dictionaries are stored, use the find.dictionaries function. These dictionaries are only stored on your private computer and must either be publicly shared or transferred to other computers in order to use them elsewhere. If you would like to share a dictionary for others to use, then please submit a pull request or post an issue with your dictionary on my GitHub: AlexChristensen/SemNetDictionaries.

Value

If save.location = "envir", the sorted, unique, lower case words (vector). Otherwise, the dictionary is saved to a file and NULL is returned invisibly

Author(s)

Alexander Christensen <alexpaulchristensen@gmail.com>

See Also

find.dictionaries to find where dictionaries are stored, dictionaries to identify dictionaries in SemNetDictionaries

Examples

# Create a dictionary
new.dictionary <- append.dictionary(c("words","are","fun"), save.location = "envir")


British-US English Conversions

Description

A database to convert between British and US spellings (n = 780)

Usage

data(brit2us)

Format

brit2us (list, length = 780)

Examples

data("brit2us")

Corpus of Contemporary American English Dictionary

Description

A general dictionary of over 80,000 words from the Corpus of Contemporary American English derived from https://www.wordfrequency.info/samples.asp.

Usage

data(coca.dictionary)

Format

coca.dictionary (vector, length = 80381)

Details

To add additional words to the dictionary, please make an appendix dictionary (append.dictionary)

Examples

data("coca.dictionary")

Corpus of Contemporary American English Moniker

Description

A database of word forms for the Corpus of Contemporary American English dictionary

Usage

data(coca.moniker)

Format

coca.moniker (list, length = 20225)

Details

To add additional COCA monikers to the database, please submit a pull request or issue to https://github.com/AlexChristensen/SemNetDictionaries

Examples

data("coca.moniker")

Corpus of Contemporary American English and Hunspell Combined Dictionary

Description

A general dictionary of over 109,000 words from the Corpus of Contemporary American English dictionary (coca.dictionary) and Hunspell dictionary (hunspell.dictionary).

Usage

data(cocaspell.dictionary)

Format

cocaspell.dictionary (vector, length = 109179)

Details

To add additional words to the dictionary, please make an appendix dictionary (append.dictionary)

Examples

data("cocaspell.dictionary")

Corpus of Contemporary American English and Hunspell Moniker

Description

A database of word forms for the Corpus of Contemporary American English and Hunspell dictionaries

Usage

data(cocaspell.moniker)

Format

cocaspell.moniker (list, length = 30468)

Details

To add additional COCA and Hunspell monikers to the database, please submit a pull request or issue to https://github.com/AlexChristensen/SemNetDictionaries

Examples

data("cocaspell.moniker")

List Names of Dictionaries in 'SemNetDictionaries'

Description

A wrapper function to identify all dictionaries included in SemNetDictionaries

Usage

dictionaries(quiet = FALSE)

Arguments

quiet

Boolean. Determines whether the return should be quiet (does not print dictionaries). Defaults to FALSE

Value

Returns the names of dictionaries in SemNetDictionaries (invisibly unless quiet = TRUE)

Author(s)

Alexander Christensen <alexpaulchristensen@gmail.com>

See Also

find.dictionaries to find where dictionaries are stored, append.dictionary to create a new dictionary

Examples

# List names of dictionaries in 'SemNetDictionaries'
dictionaries()


Finds Names and Locations of Appendix Dictionaries

Description

A wrapper function to identify the save location of appendix dictionaries from append.dictionary

Usage

find.dictionaries(..., add.path = NULL, recursive = FALSE)

Arguments

...

Vector. Dictionary names (if they are known). If left empty, all dictionaries that can be found are returned.

add.path

Character. Path to a directory with additional dictionaries to be found. Set to "choose" to open an interactive directory explorer

recursive

Boolean. Should directories be searched recursively (through all folders in them)? Defaults to FALSE because searching large folders is time intensive

Details

Dictionaries are looked for in the SemNetDictionaries package, R's global environment (objects called "*.dictionary"), and "*.dictionary.rds" files in add.path, the working directory, and tempdir()

Value

names

Returns the names of the dictionaries found

files

Returns where each dictionary is stored: "package", "envir", or the path to the file. If there is no output (e.g., character(0)), then no dictionary was found (one can be created using the append.dictionary function)

Author(s)

Alexander Christensen <alexpaulchristensen@gmail.com>

See Also

append.dictionary to create a new dictionary, dictionaries to identify dictionaries in SemNetDictionaries, and load.dictionaries to load multiple dictionaries

Examples

# Make a dictionary
example.dictionary <- append.dictionary(c("words","are","fun"), save.location = "envir")
 
# Dictionary can now be found
find.dictionaries("example")
# All dictionaries that can be found
find.dictionaries()


Fruits Dictionary

Description

A database of possible fruits responses (n = 481)

Usage

data(fruits.dictionary)

Format

fruits.dictionary (vector, length = 481)

Details

To add additional fruits to the dictionary, please make an appendix dictionary (append.dictionary)

Examples

data("fruits.dictionary")

Fruits Moniker

Description

A database of possible fruits monikers and common spelling errors

Usage

data(fruits.moniker)

Format

fruits.moniker (list, length = 79)

Details

To add additional fruits monikers to the database, please submit a pull request or issue to https://github.com/AlexChristensen/SemNetDictionaries

Examples

data("fruits.moniker")

General Dictionary

Description

A general dictionary of over 370,000 words (n = 369327) derived from https://github.com/dwyl/english-words. All punctuation have been removed.

Usage

data(general.dictionary)

Format

general.dictionary (vector, length = 369327)

Details

To add additional words to the dictionary, please make an appendix dictionary (append.dictionary)

Examples

data("general.dictionary")

'Good' Synonyms Dictionary

Description

A database of possible good synonym responses (n = 316) To add additional good synonyms to the dictionary, please make an appendix dictionary (append.dictionary)

Usage

data(good.dictionary)

Format

good.dictionary (vector, length = 316)

Examples

data("good.dictionary")

'Good' Moniker

Description

A database of possible good monikers and common spelling errors

Usage

data(good.moniker)

Format

good.moniker (list, length = 41)

Details

To add additional good monikers to the database, please submit a pull request or issue to https://github.com/AlexChristensen/SemNetDictionaries

Examples

data("good.moniker")

'Hot' Synonyms Dictionary

Description

A database of possible hot synonym responses (n = 273) To add additional hot synonyms to the dictionary, please make an appendix dictionary (append.dictionary)

Usage

data(hot.dictionary)

Format

hot.dictionary (vector, length = 273)

Examples

data("hot.dictionary")

Hot Moniker

Description

A database of possible hot monikers and common spelling errors

Usage

data(hot.moniker)

Format

hot.moniker (list, length = 64)

Details

To add additional hot monikers to the database, please submit a pull request or issue to https://github.com/AlexChristensen/SemNetDictionaries

Examples

data("hot.moniker")

hunspell Dictionary

Description

A general dictionary of over 62,000 words from the hunspell dictionary derived from wordlist.aspell.net/dicts/.

Usage

data(hunspell.dictionary)

Format

hunspell.dictionary (vector, length = 62542)

Details

To add additional words to the dictionary, please make an appendix dictionary (append.dictionary)

Examples

data("hunspell.dictionary")

Jobs Dictionary

Description

A database of possible jobs and related words (n = 1023)

Usage

data(jobs.dictionary)

Format

jobs.dictionary (vector, length = 1023)

Details

To add additional jobs to the dictionary, please make an appendix dictionary (append.dictionary)

Examples

data("jobs.dictionary")

Jobs Moniker

Description

A database of possible jobs monikers and common spelling errors

Usage

data(jobs.moniker)

Format

jobs.moniker (list, length = 152)

Details

To add additional jobs monikers to the database, please submit a pull request or issue to https://github.com/AlexChristensen/SemNetDictionaries

Examples

data("jobs.moniker")

Load Dictionaries

Description

A wrapper function to load dictionaries into the 'SemNetCleaner' package. Searches for dictionaries in the SemNetDictionaries package, R's global environment, and a few directories on your computer. Outputs a unique word list that is combined from all dictionaries entered in the ... argument

Usage

load.dictionaries(..., add.path = NULL)

Arguments

...

Character. Dictionaries to load. Dictionary names are not case sensitive for the dictionaries in SemNetDictionaries and for single letters. A ".dictionary" suffix is ignored.

Dictionaries in your global environment MUST be objects called "*.dictionary" (see examples)

More than 10 values that are not all dictionary names are treated as a corpus: the (lower case) words are returned as a sorted, unique vector

add.path

Character. Path to a directory with additional "*.dictionary.rds" files (see append.dictionary). The directory is NOT searched recursively. Set to "choose" to open an interactive directory explorer

Dictionaries are looked for in this order: the SemNetDictionaries package (see dictionaries), the global environment, add.path, the working directory, and tempdir() (see find.dictionaries)

Value

Returns a vector of unique words that have been combined and alphabetized from the specified dictionaries. If a dictionary cannot be found, a warning of class "semnet_dictionary_not_found" is given and the dictionary is left out (an empty character vector is returned when none are found)

Author(s)

Alexander Christensen <alexpaulchristensen@gmail.com>

Examples

# Find dictionaries to load
dictionaries()

# Load "animals" dictionary
load.dictionaries("animals")

# Create a dictionary
new.dictionary <- append.dictionary("words", "are", "fun")

# Load created dictionary
load.dictionaries("new")

# Load animals and new dictionary
load.dictionaries("animals", "new")

# Single letter dictionary
load.dictionaries("d")

# Multiple letters dictionary
load.dictionaries("a", "d")

# Category and letters dictionary
load.dictionaries("animals", "a")


Load Monikers

Description

A wrapper function to load monikers into the 'SemNetCleaner' package. Searches for monikers in R's SemNetDictionaries package. Outputs a unique word list that is combined from all dictionaries entered in the moniker argument

Usage

load.monikers(moniker, vector = TRUE)

Arguments

moniker

Character vector. monikers to load (must be a dictionary in dictionaries). Names that do not have a moniker (e.g., "general") or that are not in the package (e.g., your own dictionaries) are skipped. Names are not case sensitive and a ".moniker" suffix is ignored. More than 10 values that are not all dictionary names are treated as a corpus, which does not have monikers

vector

Boolean. Should output be a vector? If FALSE, then output is a list. Defaults to TRUE

Details

A moniker table maps variants of a word (common misspellings, plurals, spacing and hyphenation, abbreviations, and alternate names) to the word that is in the dictionary (the target). In 'SemNetCleaner', a response that is not in the dictionary is converted to the target of the variant that matches it. Because responses that are in the dictionary are accepted as they are, a variant is never also an entry in the dictionary of the same category.

New variants are welcome. Submit them at https://github.com/AlexChristensen/SemNetDictionaries

Value

If vector = TRUE, a character vector with the variants (misspellings, plurals, alternate names) sorted alphabetically. The names are the target word, followed by a number when a target word has more than one variant (e.g., "alligator2"). If vector = FALSE, a named list with the variants of each target word. An empty vector (list) is returned when no moniker is found

Author(s)

Alexander Christensen <alexpaulchristensen@gmail.com>

Examples

#find dictionaries to load
dictionaries()

#load "animals" monikers
load.monikers("animals")


Most Common Dictionary

Description

A general dictionary of 10,000 of the most common U.S. English words derived from https://github.com/first20hours/google-10000-english.

Usage

data(most_common.dictionary)

Format

most_common.dictionary (vector, length = 9318)

Details

To add additional words to the dictionary, please make an appendix dictionary (append.dictionary)

Examples

data("most_common.dictionary")

Stop Words Dictionary

Description

A selection of stop words that can be removed from semantic responses (n = 57)

Usage

data(stop_words.dictionary)

Format

stop_words.dictionary (vector, length = 57)

Details

To add additional animals to the dictionary, please make an appendix dictionary (append.dictionary)

Examples

data("stop_words.dictionary")

Vegetables Dictionary

Description

A database of possible vegetables responses (n = 340)

Usage

data(vegetables.dictionary)

Format

vegetables.dictionary (vector, length = 340)

Details

To add additional vegetables to the dictionary, please make an appendix dictionary (append.dictionary)

Examples

data("vegetables.dictionary")

Vegetables Moniker

Description

A database of possible vegetables monikers and common spelling errors

Usage

data(vegetables.moniker)

Format

vegetables.moniker (list, length = 70)

Details

To add additional vegetables monikers to the database, please submit a pull request or issue to https://github.com/AlexChristensen/SemNetDictionaries

Examples

data("vegetables.moniker")