knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(jtracer) jtrace_install()
The jtrace_create_lexicon
function generates a new lexicon ready to be loaded to jTRACE and used in simulations. You will only need to provide phonological forms of the words you wish to include in the lexicon (in jTRACE notation) and their lexical frequency in the language of interest (English, Spanish, or Catalan).
Since lexical frequencies are required to run a simulation, you must do so before creating your custom lexicon. You can extract the absolute, relative, or Zipf-transformed lexical frequencies of the words using the jtrace_get_frequency
(see example below). You can consult the built-in dataset frequencies
(see ?frequencies
) to see the complete list of frequencies available (extracted from the SUBTLEX-UK, SUBTLEX-ESP, and SUBTLEX-CAT databases):
head(frequencies)
The language
argument controls that language lexical frequencies should be looked up into, and the scale
argument indicates the scale of the lexical frequencies that should be returned: "frequency_abs" (raw counts), "frequency_rel" (counts per million words), or "frequency_zipf" (Zipf-transformed frequencies). Following jTRACE's standards, frequencies are computed as counts per million by default.
my_words <- c("plane", "cake", "tiger", "ham", "seat") my_freqs <- jtrace_get_frequency( word = my_words, language = "English", scale = c("frequency_abs", "frequency_zipf") ) head(my_freqs)
Now we can create a new lexicon, which we will call "custom":
my_phons <- c("plEIn", "kEIk", "taIÉ¡@", "ham", "sit") jtrace_create_lexicon( phonology = my_phons, frequency = my_freqs$frequency_abs, lexicon_name = "my_lex" )
Now we can check that our lexicon is available:
jtrace_list_lexicons()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.