Skip to contents

The $closest_terms() method does this and that..

Usage

closest_terms(
  epa,
  component = c("identity", "behavior", "modifier"),
  max_dist = 1
)

Arguments

epa

a vector or list of epa ratings

component

a vector or list of epa ratings

max_dist

a positive real number

It also works with one row data frame with e, p, and a columns

Value

a list of closest terms found in $dictionary, sorted by closeness.

Examples

act <- interact()
#>  dictionary = list(dataset = "usfullsurveyor2015", group = "all")
#>  equations = list(key = "us2010", group = "all")

act$closest_terms(c(e = 2, p = 1, a = 0), component = "identity", max_dist = 0.2)
#>             lady graduate_student    forest_ranger      wage_earner 
#>           0.0145           0.0227           0.0501           0.0826 
#>            baker    social_worker       non_smoker     nutritionist 
#>           0.0945           0.0973           0.1034           0.1556 
#>           artist 
#>           0.1829 
act$closest_terms(c(e = 2, p = 1, a = 0), component = "behavior", max_dist = 0.2)
#>     turn_to     consult         ask  agree_with   ask_about      answer 
#>      0.0566      0.0801      0.0923      0.1022      0.1649      0.1808 
#>   dine_with concur_with 
#>      0.1934      0.1978 
act$closest_terms(c(e = 2, p = 1, a = 0), component = "modifier", max_dist = 0.2)
#> light_hearted          cute       dutiful      carefree       gourmet 
#>        0.0474        0.1396        0.1709        0.1982        0.1997 

## Using `$closest_terms()` on event deflection data frames

d <- act$deflection(list(A = "ceo", B = "kick", O = "ceo"))
d
#> # Event deflection
#> # A data frame: 1 × 4
#>   A     B     O     deflection
#> * <chr> <chr> <chr>      <dbl>
#> 1 ceo   kick  ceo         30.2
opt_reidentify <- act$reidentify(d, who = "object")
opt_reidentify
#> # A tibble: 1 × 3
#>       Oe    Op    Oa
#>    <dbl> <dbl> <dbl>
#> 1 -0.507 -2.63 -1.91
act$closest_terms(opt_reidentify, max_dist = 1)
#>          nobody          victim        weakling         shut_in         cripple 
#>       0.1665388       0.4721416       0.6651541       0.7311867       0.7626249 
#> homeless_person           dummy 
#>       0.8316222       0.8925427 
opt_behavior <- act$optimal_behavior(d, who = "object")
act$closest_terms(opt_behavior, max_dist = 0.5, component = "behavior")
#>      defeat   apprehend debate_with    confront   challenge        urge 
#>   0.1659501   0.3250959   0.3304993   0.3353730   0.4298606   0.4782635 
#>  sleep_with 
#>   0.4949517