extract_context {poldis} | R Documentation |
Extract context for string matches
Description
A function for getting string matches and the context in which they occur.
Usage
extract_context(match, v, level = "sentences", n = 1)
Arguments
match |
Character string to be matched. For multiple strings, please use "|" as a separator. |
v |
Text vector or annotated data frame. |
level |
At which text level do you want matches to be returned? Defaults to "sentences". Options are sentences, words, and paragraph. |
n |
Number of sentences or words matched before and after string match. Defaults to 1. That is, one word or one sentence before, and after, string match. For paragraphs, n is always set to one. |
Value
A list of string matches and their context.
Examples
extract_context(match = "war|weapons of mass destruction|conflict|NATO|peace",
v = US_News_Conferences_1960_1980$text[100],
level = "sentences", n = 2)
[Package poldis version 0.1.1 Index]