# NOT RUN {
# Fetch metadata of every query hit for "Ameisenplage" and show a summary
# }
# NOT RUN {
new("KorAPConnection") %>% corpusQuery("Ameisenplage") %>% fetchAll()
# }
# NOT RUN {
# Use the copy of a KorAP-web-frontend URL for an API query of "Ameise" in a virtual corpus
# and show the number of query hits (but don't fetch them).
new("KorAPConnection", verbose = TRUE) %>%
corpusQuery(KorAPUrl =
"https://korap.ids-mannheim.de/?q=Ameise&cq=pubDate+since+2017&ql=poliqarp")
# Plot the time/frequency curve of "Ameisenplage"
# }
# NOT RUN {
new("KorAPConnection", verbose=TRUE) %>%
{ . ->> kco } %>%
corpusQuery("Ameisenplage") %>%
fetchAll() %>%
slot("collectedMatches") %>%
mutate(year = lubridate::year(pubDate)) %>%
dplyr::select(year) %>%
group_by(year) %>%
summarise(Count = dplyr::n()) %>%
mutate(Freq = mapply(function(f, y)
f / corpusStats(kco, paste("pubDate in", y))@tokens, Count, year)) %>%
dplyr::select(-Count) %>%
complete(year = min(year):max(year), fill = list(Freq = 0)) %>%
plot(type = "l")
# }
Run the code above in your browser using DataLab