Learn R Programming

sumer (version 1.4.0)

sign_grammar: Grammatical Type Frequencies for Each Sign in a Sumerian Sentence

Description

For each cuneiform sign in a Sumerian sentence, looks up the dictionary to determine the frequency of each individual grammatical type (e.g., S, V, Sx->S, xS->A). Returns a data frame with one row per sign per grammatical type.

Usage

sign_grammar(x, dic, mapping = NULL)

Value

A data frame with columns:

position

Integer. Position of the sign in the sentence.

sign_name

Character. The sign name (e.g., "KA").

cuneiform

Character. The cuneiform character.

type

Character. The grammar type string (e.g., "S", "V", "Sx->S").

n

Integer. Sum of dictionary counts for this sign and this type.

Arguments

x

A single character string containing a Sumerian sentence (cuneiform, sign names, or transliteration).

dic

A dictionary data frame as returned by read_dictionary.

mapping

A data frame containing the sign mapping table with columns syllables, name, and cuneiform. If NULL (the default), the package's internal mapping file etcsl_mapping.txt is loaded.

Details

The function converts the input to cuneiform, splits it into individual signs, and looks up each sign in the dictionary. For each sign, the translations are grouped by their individual type string (e.g., "S", "V", "Sx->S", "xS->A").

For each type the dictionary count values are summed. If a translation entry has no count, it is treated as 1.

The set of types returned is the union of all types found across all signs in the sentence. Each sign gets one row per type, even if the count is 0 for that type.

See Also

grammar_probs for Bayesian posterior probabilities, plot_sign_grammar for visualising the result, read_dictionary for loading a dictionary, as.cuneiform for cuneiform conversion.

Examples

Run this code
dic <- read_dictionary()

# Analyse a sentence
sg <- sign_grammar("a-ma-ru ba-ur3 ra", dic)
print(sg)

# Use with cuneiform input
x<-"\U00012000\U000121AD"
print(x)
sg <- sign_grammar(x, dic)
print(sg)

Run the code above in your browser using DataLab