<<<<<<< HEAD ======= >>>>>>> a860ed73d154cfc16fd6c4b404696d1139058524

A function to convert ARPABET symbols to lexical set keywords.

arpa_to_keywords(x, style = "wells", ordered = TRUE, as_character = FALSE)

arpa_to_wells(x, ...)

wells_to_arpa(x, ordered = TRUE, as_character = FALSE)

Arguments

x

The vector containing the vowel labels you want to convert.

style

a string. By default, "Wells", which will produce the original Wells labels. If set to "b_t", it will use the "B_T" frame.

ordered

a logical. by default, TRUE, which will return the factor in an order that goes approximately counter clockwise in the vowel space, with diphthongs last. If FALSE, it will retain the original order (which, unless already specified, will be alphabetical or the order in which R sees the individial levels).

as_character

a logical. FALSE by default, meaning it will return the vector as a factor in the order specified by ordered. If TRUE, it will return the vector as a character vector (and will silently ignore the ordered argument).

Value

A vector with the factors recoded. Any string that is not one of the following will be silently ignored: IY, IH, EY, EH, AE, AA, AO, AH, OW, UH, UW, AY, AW, OY, ER.

Details

Linguists use different ways to code English vowels in a computer-friendly way. FAVE-Align and MFA use ARPABET, which assigns a two-letter code to each vowel phoneme (IY, IH, EY, EH, etc.). An alternative approach is to use a keyword denoting a lexical set, whether it be the original Wells keywords or an alternative using the "B_T" frame. See this blog post for more background.

The original Wells' lexical keywords in this function are FLEECE, KIT, FACE, DRESS, TRAP, LOT, THOUGHT, STRUT, GOAT, FOOT, GOOSE, PRICE, MOUTH, CHOICE, and NURSE.

The lexical set using the B_T frame include BEET, BIT, BAIT, BET, BAT, BOT, BOUGHT, BUT, BOAT, BOOK, BOOT, BITE, BOUT, BOY, and BIRD.

Note that arpa_to_wells is shorthand for arpa_to_keywords(style="wells"), and only exports to the Wells lexical sets. wells_to_arpa is the reverse function and converts Wells lexical sets back into ARPABET.

Examples

suppressPackageStartupMessages(library(tidyverse)) darla <- joeysvowels::darla darla %>% mutate(vowel = arpa_to_keywords(vowel)) %>% count(vowel)
#> vowel n #> 1 FLEECE 485 #> 2 KIT 390 #> 3 FACE 250 #> 4 DRESS 231 #> 5 TRAP 175 #> 6 LOT 141 #> 7 THOUGHT 244 #> 8 STRUT 283 #> 9 GOAT 285 #> 10 FOOT 55 #> 11 GOOSE 267 #> 12 PRICE 214 #> 13 MOUTH 93 #> 14 CHOICE 13 #> 15 NURSE 378
darla %>% mutate(vowel = arpa_to_keywords(vowel, ordered = FALSE)) %>% count(vowel)
#> vowel n #> 1 LOT 141 #> 2 TRAP 175 #> 3 STRUT 283 #> 4 THOUGHT 244 #> 5 MOUTH 93 #> 6 PRICE 214 #> 7 DRESS 231 #> 8 NURSE 378 #> 9 FACE 250 #> 10 KIT 390 #> 11 FLEECE 485 #> 12 GOAT 285 #> 13 CHOICE 13 #> 14 FOOT 55 #> 15 GOOSE 267
darla %>% mutate(vowel = arpa_to_keywords(vowel, style = "b_t", as_character = TRUE)) %>% count(vowel)
#> vowel n #> 1 BAIT 250 #> 2 BAT 175 #> 3 BEET 485 #> 4 BET 231 #> 5 BIRD 378 #> 6 BIT 390 #> 7 BITE 214 #> 8 BOAT 285 #> 9 BOOK 55 #> 10 BOOT 267 #> 11 BOT 141 #> 12 BOUGHT 244 #> 13 BOUT 93 #> 14 BOY 13 #> 15 BUT 283
# Works even if not all vowel levels are present darla %>% filter(vowel %in% c("IY", "AE", "AY", "UW")) %>% mutate(vowel = arpa_to_keywords(vowel)) %>% count(vowel)
#> vowel n #> 1 FLEECE 485 #> 2 TRAP 175 #> 3 GOOSE 267 #> 4 PRICE 214
# Here's a non-tidyverse version (though tidyverse is still used under the hood) darla$vowel <- arpa_to_keywords(darla$vowel)