Learn R Programming

sumer (version 1.4.0)

merge_dictionaries: Merge Two or More Sumerian Dictionaries

Description

Combines two or more dictionaries (as produced by make_dictionary) into a single dictionary. Translation entries that agree in sign name, grammatical type, and meaning are merged by summing their counts. Cuneiform and reading rows are taken from the first dictionary that contains them.

Usage

merge_dictionaries(...)

Value

A data frame with five columns in the standard dictionary format:

sign_name

Character. The sign name (e.g. "A", "LUGAL").

row_type

Character. One of "cunei.", "reading", or "trans.".

count

Numeric. The (merged) occurrence count for translation rows; NA for cuneiform and reading rows.

type

Character. The grammatical type for translation rows (e.g. "S", "V"); empty for cuneiform and reading rows.

meaning

Character. The cuneiform glyph, the reading notation, or the translation text, depending on row_type.

Arguments

...

Two or more dictionaries, each either a data frame (as returned by make_dictionary or read_dictionary) or a file path to a dictionary file. A single list of dictionaries is also accepted.

Details

The function processes the three row types differently:

"cunei." and "reading"

Each sign name has at most one row of each type. If multiple input dictionaries contain a cuneiform or reading row for the same sign, the row from the first dictionary (in argument order) is kept.

"trans."

Rows that share the same sign_name, type, and meaning are merged into a single row whose count is the sum of the individual counts. Rows that differ in type or meaning are kept as separate entries.

The result is sorted by sign_name, then row_type, then descending count, matching the order produced by make_dictionary.

Note: Merging dictionaries is most meaningful when the underlying text corpora come from comparable periods and regions of Mesopotamia. Combining dictionaries from widely different epochs or dialects may produce misleading frequency counts, since the same sign can carry different meanings across time and place.

See Also

make_dictionary for creating a dictionary from a translated text, read_dictionary for loading a dictionary from file, save_dictionary for saving a dictionary to file, convert_to_dictionary for the aggregation step inside make_dictionary

Examples

Run this code
# Load the built-in dictionary
dic1 <- read_dictionary()

# Make a dictionary from some translations of "Enki and the World Order"
path <- system.file("extdata", "project/lines", package = "sumer")
dic2 <- make_dictionary(list.files(path, full.names=TRUE)[1:10])

# Merge both dictionaries
dic <- merge_dictionaries(dic1, dic2)

#Test the function
look_up("IL2", dic1)
look_up("IL2", dic2)
look_up("IL2", dic)

Run the code above in your browser using DataLab