# --- Base type (operator without arguments) ---
# A simple substantive passes through unchanged:
sumer:::eval_operator("S", "temple")
# [1] "S" "temple"
# With {specific} extraction:
sumer:::eval_operator("S", "place {earth}")
# [1] "S" "earth"
# --- Operator with one argument: Sx->V ---
# The S argument gets "the " prepended (since result type is V, not S):
args <- list(c("S", "temple"))
sumer:::eval_operator("Sx->V", "to utilize S", args)
# [1] "V" "to utilize the temple"
# --- Operator with two S arguments: SSx->V ---
# Duplicate types get indexed names (S1, S2):
args <- list(c("S1", "leader"), c("S2", "temple"))
sumer:::eval_operator("SSx->V", "to equip S1 with S2", args)
# [1] "V" "to equip the leader with the temple"
# --- Composition: S + A -> S ---
args <- list(c("S", "temple"), c("A", ", which is a great one"))
sumer:::eval_operator(NULL, NULL, args)
# [1] "S" "temple, which is a great one"
# --- Composition: S + V -> SEN ---
args <- list(c("S", "men"), c("V", "to bring grain into the temple"))
sumer:::eval_operator(NULL, NULL, args)
# [1] "SEN" "men bring grain into the temple"
# --- Full pipeline with add_brackets and apply_translation_rules ---
x <- "mec3-ki-aj2-ga-ce-er"
x <- as.cuneiform(x)
x
meaning <- rbind( c("S", "a man who relies on his own strength"),
c("S", "place {earth}"),
c("Sx->A", ", whose allocated resource is S"),
c("xS->A", ", whose sustenance is S"),
c("S", "grain"),
c("Sx->S", "lamented S"))
df <- data.frame(
type = meaning[,1],
translation = meaning[,2],
expr = split_sumerian(x)$signs)
s <- x
for(i in 1:nrow(df)){
s <- sub(df$expr[i], paste0("#", i), s)
}
s
s_bracketed <- sumer:::add_brackets(s, df$type)
s_bracketed
apply_translation_rules(s_bracketed$string, df$type, df$translation)
Run the code above in your browser using DataLab