output: github_document

knitr::opts_chunk$set(echo = TRUE)

dictionaRy

CRAN status

Retrieve the dictionary definition of English words in tidy format, along with their phonetics, audio pronunciation, parts of speech, origins, examples, synonyms, and antonyms.

Installation

Installation via GitHub devtools::install_github("stevecondylios/dictionaRy")

# install.packages("devtools")
devtools::install_github("stevecondylios/dictionaRy")

Future: Installation via CRAN install.packages("dictionaRy")

install.packages("dictionaRy")

Usage

Load library

library(dictionaRy)
library(tidyverse)

Get information for the word "hello":

word <- "hello"
(word_info <- define(word))

Definitions and parts of speech

word_info %>% 
  select(part_of_speech, definition)

Word origins

word_info %>% 
  select(origin)

Example word usage

word_info %>% 
  select(example)

Phonetics

View the word's phonetics as expressed in the International Phonetic Alphabet.

word_info %>% 
  select(phonetic)

Audio pronunciation

Visit the urls to hear the word spoken.

word_info %>% 
  select(audio)

Technical details on the relationship between word meanings, parts of speech, and definitions


More examples

"hello"

define("hello")

"bark"

define("bark")

"set" (..is said to have more meanings than any other English word!)

define("set")

"lead" is an example of a heteronym (a word that has a different pronunciation and meaning from another word but the same spelling)

define("lead") %>% 
  group_by(meaning_number) %>% 
  slice(1)

Visit the audio links for the first and second meanings of "lead":

  1. https://ssl.gstatic.com/dictionary/static/sounds/20200429/lead--_gb_1.mp3
  2. https://ssl.gstatic.com/dictionary/static/sounds/20200429/lead--_gb_2.mp3

Advanced usage

Iterate over many words

words <- c("hello", "bark", "set", "lead")

purrr::map_df(words, ~ define(.x))

Note that words which aren't found in the English dictionary will return 0 row tibbles, and hence will have no affect on the resulting tibble

words <- c("paint", "sldkfjlsdjkf")

purrr::map_df(words, ~ define(.x))

Bug reports, suggestions, pull requests



stevecondylios/dictionary documentation built on Feb. 18, 2022, 10:08 a.m.