show_context: Return a snippet that shows the context found.

Description Usage Arguments Value See Also Examples

Description

This function can be used to extract a small text excerpt from a text based on a context search constructed with check_context. It will show the entire sentence from the first occurance of the first relevant entity to the first sentence of the second entity.

Usage

1
show_context(text, search, case_sensitive = FALSE)

Arguments

text

A string value representing the text that is to be searched.

search

The result of a construct_search call.

case_sensitive

If TRUE, the function will ignore cases for all entities.

Value

The function will return a sub-string of text which shows you where the context was found. This is just a snippet and does not necessarily include all of the relevant text. This is especially true if more than one word of the defined entity is present within text.

See Also

construct_search for the construction of the search parameter.

Examples

1
2
3
4
5
6
text <- "There has been a crisis in Fantasia.
The USA will intervene. A proposal has been submitted to the United Nations"
A <- c("USA", "Russia", "China")
B <- c("United Nations", "WTO", "NATO")
search <- construct_search(A, B, 50)
check_context(text, search)

Jhruzik/TextContext documentation built on May 21, 2019, 9:35 a.m.