knitr::opts_chunk$set( message = FALSE, warning = FALSE, collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Authors: Ivan Pozdniakov, Frank Fischer
License: GPL-3
The goal of rdracor is to provide an R interface for the DraCor API (DraCor: Drama Corpora Project). Website of the project: dracor.org.
Installation from CRAN:
install.packages("rdracor")
If you wish to install the current build of the next release you can do so using the following:
# install.packages("remotes") remotes::install_github("dracor-org/rdracor")
library(rdracor)
DraCor API has several versions. By default, it utilizes the main branch:
get_dracor_api_url()
You can set DraCor URL API of your choice:
set_dracor_api_url("https://staging.dracor.org/api/v1")
Retrieving general information about available corpora:
corpora <- get_dracor_meta() summary(corpora) plot(corpora)
ger <- get_dracor(corpus = "ger") summary(ger)
You can get all corpora at once:
all <- get_dracor() summary(all)
With get_play_metadata()
you can get miscellaneous data for a play:
get_play_metadata(play = "lessing-emilia-galotti", corpus = "ger", full_metadata = FALSE) #use full_metadata = FALSE for faster download
You can extract a co-occurence network (undirected weighted graph) for a specific play:
emilia <- get_net_cooccur_igraph(play = "lessing-emilia-galotti", corpus = "ger") plot(emilia)
You can use the package {igraph}
to work with this object as a graph:
library(igraph) edge_density(emilia) cohesion(emilia)
In addition, you can get a summary with network properties and gender distribution:
summary(emilia)
Similarly, you can use function get_net_relations_igraph()
to build a network
based on relationships data:
galotti_relations <- get_net_relations_igraph(play = "lessing-emilia-galotti", corpus = "ger") plot(galotti_relations) summary(galotti_relations)
You can get text of a play in different forms:
{xml2}
):get_text_tei(play = "lessing-emilia-galotti", corpus = "ger")
text_galotti <- get_text_chr_spoken(play = "lessing-emilia-galotti", corpus = "ger") head(text_galotti)
get_text_df(play = "lessing-emilia-galotti", corpus = "ger")
If you want to use another version of DraCor API (e.g. staging or locally saved on your computer), you can use function set_dracor_api_url()
:
set_dracor_api_url("https://staging.dracor.org/api/v1") get_dracor("u")
Information on the working API can be retrieved by dracor_api_info()
:
dracor_api_info()
The development of this research software was supported by Computational Literary Studies Infrastructure (CLS INFRA) through its Transnational Access Fellowship programme. CLS INFRA has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement №101004984.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.