detect_any | R Documentation |
detect_any
identifies SDGs in text using user provided query systems. Works like detect_sdg_systems
but uses a user specified query system instead of an existing one like detect_sdg_systems
does.
detect_any(
text,
system,
queries = lifecycle::deprecated(),
sdgs = NULL,
output = c("features", "documents"),
verbose = TRUE
)
text |
|
system |
a data frame that must contain the following variables: a |
queries |
deprecated. |
sdgs |
|
output |
|
verbose |
|
The function returns a tibble
containing the SDG hits found in the vector of documents. Depending on the value of output
the tibble will contain all or some of the following columns:
Index of the element in text
where match was found. Formatted as a factor with the number of levels matching the original number of documents.
Label of the SDG found in document.
The name of the query system that produced the match.
Index of the query within the query system that produced the match.
Concatenated list of words that caused the query to match.
Index of hit for a given system.
# create data frame with query system
my_queries <- tibble::tibble(
system = "my_system",
query = c(
"theory",
"analysis OR analyses OR analyzed",
"study AND hypothesis"
),
sdg = c(1, 2, 2)
)
# run sdg detection with own query system
hits <- detect_any(projects, my_queries)
# run sdg detection for sdg 2 only
hits <- detect_any(projects, my_queries, sdgs = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.