Description Usage Arguments Value See Also Examples
This function is used to construct a string representing a regular expression for later use inside the check_context
function. The basic idea is that you have two distinct entities (entityA and entityB) which are defined by a set of words. Inside a text, both entities might be seperated by one or more words or characters. The resulting regular expression can be used for further data analysis.
1 2 | construct_search(entityA, entityB, fill_length, length_metric = "words",
direction = "bi")
|
entityA |
A string vector containing all the words that make up the first entity. |
entityB |
A string vector containing all the words that make up the second entity. |
fill_length |
A numeric value indicating how far away the two entities are allowed to be from each other. |
length_metric |
Either one of "words" or "chars". If "words", then fill_length represents the number of words. If "chars", fill_length represents the number of characters, including white space characters. |
direction |
Either "bi", "right", or "left". If "bi" is selected, the search will allow for entityA followed by entityB or vice versa. If "right" is specified, entityA must be followed by entityB while "left" looks for entityB followed by entityA. |
A string value representing a regular expression.
check_context
for further use of this function's output.
1 2 3 4 5 6 7 8 9 | A <- c("USA", "Russia", "China")
B <- c("United Nations", "NATO", "WTO")
search_w_bi <- construct_search(A, B, 30)
search_c_bi <- construct_search(A, B, 200,
"chars")
search_w_right <- construct_search(A, B, 30,
direction = "right")
search_c_left <- construct_search(A, B, 200,
"chars", direction = "left")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.