powered by
A convenience function that searches for contexts (documents, sentences), and uses the results to subset the tCorpus token data.
subset_query( tc, query, feature = "token", context_level = c("document", "sentence"), not = F, as_ascii = F, window = NA )
A tCorpus
tCorpus
A character string that is a query. See search_contexts for query syntax.
The name of the feature columns on which the query is used.
Select whether the query and subset are performed at the document or sentence level.
If TRUE, perform a NOT search. Return the articles/sentences for which the query is not found.
if TRUE, perform search in ascii.
If used, uses a word distance as the context (overrides context_level)
See the documentation for search_contexts for an explanation of the query language.
text = c('A B C', 'D E F. G H I', 'A D', 'GGG') tc = create_tcorpus(text, doc_id = c('a','b','c','d'), split_sentences = TRUE) ## subset by reference tc2 = subset_query(tc, 'A') tc2$meta
Run the code above in your browser using DataLab