concordance | R Documentation |
This function uses quanteda::kwic()
to return a concordance for a search pattern. The function takes as input three datasets and a pattern and returns a data frame with the hits labelled for authorship.
concordance(
q.data,
k.data,
reference.data,
search,
token.type = "word",
window = 5,
case_insensitive = TRUE
)
q.data |
A |
k.data |
A |
reference.data |
A |
search |
A string. It can be any sequence of characters and it also accepts the use of * as a wildcard. |
token.type |
Choice between "word" (default), which searches for word or punctuation mark tokens, or "character", which instead uses a single character search. |
window |
The number of context items to be displayed around the keyword (a |
case_insensitive |
Logical; if TRUE, ignore case (a |
The function returns a data frame containing the concordances for the search pattern.
concordance(enron.sample[1], enron.sample[2], enron.sample[3:49], "wants to", token.type = "word")
#using wildcards
concordance(enron.sample[1], enron.sample[2], enron.sample[3:49], "want * to", token.type = "word")
#searching character sequences with wildcards
concordance(enron.sample[1], enron.sample[2], enron.sample[3:49], "help*", token.type = "character")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.