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)
#> word language frequency_abs frequency_rel frequency_zipf
#> 1 a Catalan 6008500 2.156538e+04 7.3337572
#> 2 aalborg Catalan 19 6.819377e-02 1.8337447
#> 3 aalen Catalan 1 3.589146e-03 0.5549911
#> 4 aalsmeer Catalan 26 9.331779e-02 1.9699645
#> 5 aarau Catalan 5 1.794573e-02 1.2539611
#> 6 aare Catalan 6 2.153487e-02 1.3331424
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)
#> word language frequency_abs frequency_zipf
#> 1 plane English 7734 4.58
#> 2 cake English 12872 4.81
#> 3 tiger English 4601 4.36
#> 4 ham English 4516 4.35
#> 5 seat English 12276 4.78
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()
#> [1] "biglex_lr_^a" "biglex_lr" "biglex901" "context_lex"
#> [5] "empty" "initial_lexicon" "mayor2014_15" "mayor2014_18"
#> [9] "mayor2014_24" "sevenlex" "slex_pairs" "slex"