Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textplot_xray() from kwic() based on dictionary pattern #1684

Closed
kbenoit opened this issue May 9, 2019 · 0 comments · Fixed by #1686
Closed

textplot_xray() from kwic() based on dictionary pattern #1684

kbenoit opened this issue May 9, 2019 · 0 comments · Fixed by #1686
Assignees
Labels
kwic Keywords in context issues textplot

Comments

@kbenoit
Copy link
Collaborator

kbenoit commented May 9, 2019

I thought that in #1515, we fixed kwics to plot (in textplot_xray()) by dictionary key, not value. But it appears to be faceting on values, not keys.

library("quanteda")
## Package version: 1.4.4

# one facet per value
dict <- dictionary(list(
  preps = c("to", "of", "for"),
  articles = c("the", "an", "an")
))
corp <- corpus_subset(data_corpus_inaugural, Year %in% c(1945, 1865))
kwicdict <- kwic(corp, pattern = dict)
textplot_xray(kwicdict)

# one facet per key
tokens(corp) %>%
  tokens_lookup(dictionary = dict, exclusive = FALSE, capkeys = TRUE) %>%
  kwic(pattern = char_toupper(names(dict))) %>%
  textplot_xray()

Is that what we intended? The second form is not likely to be easy for users to apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kwic Keywords in context issues textplot
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants