Classifies queries based on recipes in a YAML file
Arguments
- kwr
A
kwresearch
object containing queries to be classified.- recipe_file
A path to a recipe file in YAML format.
- quiet
If
TRUE
, prints no messages.
Value
A kwresearch object in which the queries are classified according to the recipes in the provided YAML file. Any previous classification is preserved or updated.
Examples
queries <- data.frame(
query = c("seo", "keyword research"),
volume = c(1000, 500)
)
kwr <- kwresearch(queries)
recipe_file <- file.path(tempdir(), "my-recipes.yml")
kwr_add_pattern(
pattern = "seo",
recipe_file = recipe_file,
recipe_type = "label",
dim_name = "my_label"
)
kwr <- kwr_classify(kwr, recipe_file)
#> Label:my_label
kwr_queries(kwr)
#> # A tibble: 2 × 8
#> query_normalized my_label n_queries volume cpc query_original input source
#> <chr> <chr> <int> <dbl> <dbl> <chr> <chr> <chr>
#> 1 seo seo 1 1000 NA seo NA NA
#> 2 keyword research NA 1 500 NA keyword research NA NA
file.remove(recipe_file)
#> [1] TRUE