## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", dev = "ragg_png" ) ## ----------------------------------------------------------------------------- library(sumer) ## ----------------------------------------------------------------------------- pkg_path <- system.file("extdata", "project", package = "sumer") file.copy(from = pkg_path, to = tempdir(), recursive = TRUE) project_dir <- file.path(tempdir(), "project") cat(head(list.files(project_dir, recursive=TRUE)), sep="\n") ## ----------------------------------------------------------------------------- ctx <- translation_context( project_dir = project_dir, text = "enki_and_the_world_order.txt", dic = file.path(pkg_path, "sumer-dictionary.txt"), mapping = NULL, sentence_prob = 0.25 ) text <- readLines(ctx$text, encoding = "UTF-8") ## ----eval = FALSE------------------------------------------------------------- # translate_line(8, ctx) ## ----------------------------------------------------------------------------- i <- which(startsWith(text, "8)")) cat(text[i], sep = "\n") cat(as.sign_name(text[i]), sep = "\n") ## ----------------------------------------------------------------------------- line_files <- list.files(ctx$line_folder, full.names = TRUE) head(basename(line_files)) project_dic <- make_dictionary(line_files) ## ----------------------------------------------------------------------------- look_up("AN", project_dic) ## ----------------------------------------------------------------------------- dic1 <- read_dictionary() merged_dic <- merge_dictionaries(dic1, project_dic) ## ----------------------------------------------------------------------------- look_up("LAM", dic1) look_up("LAM", project_dic) look_up("LAM", merged_dic) ## ----eval = FALSE------------------------------------------------------------- # save_dictionary( # dic = merged, # file = "my_dictionary.txt", # author = "My Name", # year = "2026", # version = "1.0", # url = "https://example.com/dictionary" # )