library(polmineR)
library(gradget)
library(magrittr)
library(pbapply)
library(igraph)
runcode <- if (require("GermaParl", quietly = TRUE)) TRUE else FALSE
if (runcode) use ("GermaParl")

2D

G <- merkel2008
igraph_as_svg(merkel2008) %>% plot()

Tab {.smaller}

use("GermaParl")
bt2008 <- partition("GERMAPARL", year = 2008)
kwic(bt2008, query = "Integration")

Merkel 2008 {.flexbox .vcenter}

merkel2008 <- partition(
  "GERMAPARL",
  speaker = "Angela Merkel", year = 2008, interjection = FALSE,
  p_attribute = "word"
)

terms_to_drop <- p_attributes(merkel2008, p_attribute = "word") %>%
  noise(verbose = FALSE) %>%
  unlist() %>%
  unname() %>%
  c(polmineR::punctuation)

G <- Cooccurrences(merkel2008, "word", 5L, 5L, terms_to_drop) %>%
  ll() %>%
  decode() %>%
  subset(rank_ll <= 250) %>%
  kwic() %>%
  as_igraph() %>%
  igraph_add_coordinates(layout = "kamada.kawai", dim = 3) %>%
  igraph_add_communities() %>%
  rescale(-250, 250)

# G <- igraph_add_kwic(G, subcorpus = merkel2008)

GR <- gradget::igraph_as_gradget_data(G)

Y <- three(GR, knitr = TRUE, raycaster = TRUE)
Y


PolMine/polmineR.graph documentation built on April 27, 2020, 3:24 a.m.