knitr::opts_chunk$set(echo = TRUE) knitr::opts_knit$set(root.dir = here::here()) library(tidyverse)
ipa_symbols <- read_csv("./data-raw/ipa_symbols.csv") %>% mutate( specs_n = lengths(str_split(ipa_name, " ")), spec_1 = word(ipa_name, 1), type = case_when( spec_1 %in% c( "voiceless", "voiced", "simultaneous", "epiglottal", "retroflex") & specs_n > 1 & str_detect(uni_name, pattern = "modifier", negate = TRUE) & str_detect(uni_name, pattern = "combining", negate = TRUE) ~ "consonant", spec_1 %in% c("open", "close", "open-mid", "close-mid", "lax", "raised", "lowered", "mid-central") & specs_n > 1 ~ "vowel", TRUE ~ "diacritic" ), height_ipa = case_when( type == "vowel" & specs_n == 2 ~ word(ipa_name, 1), type == "vowel" & specs_n == 3 ~ word(ipa_name, 1), type == "vowel" & specs_n == 4 ~ word(ipa_name, 1, 2) ), height = case_when( height_ipa == "open" ~ "low", height_ipa == "raised open" ~ "low_raised", height_ipa == "lowered" ~ "low_raised", height_ipa == "close-mid" ~ "mid-high", height_ipa == "mid-central" ~ "mid-central", height_ipa == "open-mid" ~ "mid-low", height_ipa == "close" ~ "high", height_ipa == "lax close" ~ "high_lowered" ), backness = case_when( ipa_name %in% c("lowered schwa", "mid-central schwa") ~ "central", type == "vowel" & specs_n == 2 ~ word(ipa_name, 1), type == "vowel" & specs_n == 3 ~ word(ipa_name, 2), type == "vowel" & specs_n == 4 ~ word(ipa_name, 3) ), rounding = case_when( type == "vowel" ~ ifelse(word(ipa_name, -1) == "schwa", "unrounded", word(ipa_name, -1)) ), voicing = case_when( type == "consonant" ~ ifelse(word(ipa_name, 1) %in% c("voiceless", "voiced"), word(ipa_name, 1), "voiceless") ), place = case_when( type == "consonant" & specs_n == 2 ~ word(ipa_name, 1), type == "consonant" & specs_n > 2 ~ ifelse(word(ipa_name, 1) == "simultaneous", "postalveolar-velar", word(ipa_name, 2)) ), manner = case_when( type == "consonant" & specs_n == 2 ~ word(ipa_name, 2), type == "consonant" & specs_n == 3 ~ word(ipa_name, 3), type == "consonant" & specs_n == 4 ~ word(ipa_name, 4) ), lateral = str_detect(ipa_name, "lateral"), sonorant = case_when( type == "vowel" ~ TRUE, type == "consonant" & manner %in% c("approximant", "flap", "nasal", "tap", "trill") ~ TRUE, type == "consonant" & manner %in% c("click", "fricative", "implosive", "plosive") ~ FALSE ) ) %>% dplyr::select(-specs_n, -spec_1)
usethis::use_data(ipa_symbols, overwrite = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.