rperseus
provides tools to get and analyze classical texts. Version 0.1.2 includes:
get_perseus_text
, a function to obtain a text from the Perseus Digital Libraryperseus_parallel
, a function to render a text parallel in ggplot2
parse_excerpt
, a function to parse any Greek excerptperseus_catalog
, a data frame of available textsgreek_stop_words
, a data frame of Greek pronouns, articles, prepositions, and particleslibrary(rperseus) head(perseus_catalog)
A snapshot of available authors:
library(dplyr) count(perseus_catalog, group_name, sort = TRUE)
Once you've identified the relevant URN, paste it into a call to get_perseus_text
. Here I've called for the Greek text of Plato's Crito:
crito <- get_perseus_text(urn = "urn:cts:greekLit:tlg0059.tlg003.perseus-grc2") crito$text[1]
You can collect all of Plato's available English translations with the tidyverse:
plato <- perseus_catalog %>% filter(group_name == "Plato", language == "eng") %>% pull(urn) %>% map_df(get_perseus_text)
You can render small parallels with perseus_parallel
:
tibble::tibble(label = c("Colossians", "1 Thessalonians", "Romans"), excerpt = c("1.4", "1.3", "8.35-8.39")) %>% dplyr::left_join(perseus_catalog) %>% dplyr::filter(language == "grc") %>% dplyr::select(urn, excerpt) %>% as.list() %>% purrr::pmap_df(get_perseus_text) %>% perseus_parallel(words_per_row = 4)
You can parse any Greek excerpt with parse_excerpt
. A data frame is returned including part of speech, person, number, tense, mood, voice, gender, case, and degree.
parse_excerpt("urn:cts:greekLit:tlg0031.tlg002.perseus-grc2", "5.1-5.3")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.