# Read translations from a single text document
filename <- system.file("extdata", "text_with_translations.txt", package = "sumer")
translations <- read_translated_text(filename)
# View the structure
head(translations)
# Filter by grammatical type
nouns <- translations[translations$type == "S", ]
nouns
#Make some custom unifications (here: removing the word "the")
translations$meaning <- gsub("\\bthe\\b", "", translations$meaning, ignore.case = TRUE)
translations$meaning <- trimws(gsub("\\s+", " ", translations$meaning))
# View the structure
head(translations)
#Convert the result into a dictionary
dictionary <- convert_to_dictionary(translations)
# View the structure
head(dictionary)
Run the code above in your browser using DataLab