Learn R Programming

sumer (version 1.0.0)

as.cuneiform: Convert Transliterated Sumerian Text to Cuneiform

Description

Converts transliterated Sumerian text to Unicode cuneiform characters. This is a generic function with a method for character vectors.

Usage

as.cuneiform(x, ...)

# S3 method for default as.cuneiform(x, ...)

# S3 method for character as.cuneiform(x, mapping = NULL, ...)

# S3 method for cuneiform print(x, ...)

Value

as.cuneiform returns a character vector of class cuneiform with the cuneiform representation of each input element.

print.cuneiform displays a character vector of class cuneiform.

Arguments

x

For as.cuneiform: An object to be converted to cuneiform. Currently, only character vectors are supported.

For print.cuneiform: an object of class "cuneiform".

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. Only used by the character method.

...

Additional arguments passed to methods.

Details

The function processes each element of the input character vector by:

  1. Calling info to look up sign information for each transliterated sign.

  2. Extracting the Unicode cuneiform symbols for each sign.

  3. Reconstructing the cuneiform text using the original separators, but removing hyphens and periods which are only used in transliteration to indicate sign boundaries.

The default method throws an error for unsupported input types.

See Also

info for retrieving detailed sign information, split_sumerian for splitting Sumerian text into signs, as.sign_name for converting transliterated Sumerian text intos sign names

Examples

Run this code

# Convert transliterated text to cuneiform
as.cuneiform(c("na-an-jic li-ic ma","en tarah-an-na-ke4"))

# Load transliterated text from a file
file <- system.file("extdata", "transliterated-text.txt", package = "sumer")
x <- readLines(file)
cat(x, sep="\n")

# Convert transliterated text to cuneiform
as.cuneiform(x)

# Using a custom mapping table
path <- system.file("extdata", "etcsl_mapping.txt", package = "sumer")
my_mapping <- read.csv2(path, sep=";", na.strings="")
as.cuneiform("lugal", mapping = my_mapping)

# Error for unsupported types
# \donttest{
as.cuneiform(123)
# Error in as.cuneiform.default(123) : Cannot coerce to cuneiform
# }

Run the code above in your browser using DataLab