gesistsa / sweater

👚 Speedy Word Embedding Association Test & Extras using R
GNU General Public License v3.0
27 stars 4 forks source link

names for vectors in output object? #27

Closed cmaimone closed 2 years ago

cmaimone commented 2 years ago

Can the S_diff and T_diff components of the output for the method have names? I think each value corresponds to an input term, yes? Would be more useful as named vectors.

> sw$S_diff
[1]  0.003158583  0.003242220  0.001271607  0.031652155  0.003074379  0.016247332  0.035000510 -0.010817083
> sw$T_diff
[1] -0.0265718087  0.0054876842 -0.0523231481 -0.0117847993 -0.0369267966  0.0224587349 -0.0167662057
[8]  0.0003334358

re: https://github.com/openjournals/joss-reviews/issues/4036

chainsawriot commented 2 years ago

@cmaimone I thought that S_diff and T_diff are not very useful for interpretation (unlike p from other tests; although a more positive diff of a word indicates a higher association with A relative to B and vice versa). But yeah, for the sake of completeness, the two vectors should also be named. It is now fixed (and tested).

require(sweater)
#> Loading required package: sweater

S4 <- c("math", "algebra", "geometry", "calculus", "equations", "computation", "numbers", "addition")
T4 <- c("poetry", "art", "dance", "literature", "novel", "symphony", "drama", "sculpture")
A4 <- c("male", "man", "boy", "brother", "he", "him", "his", "son")
B4 <- c("female", "woman", "girl", "sister", "she", "her", "hers", "daughter")
sw <- query(glove_math, S4, T4, A4, B4)
sw$S_diff
#>         math      algebra     geometry     calculus    equations  computation 
#>  0.003158583  0.003242220  0.001271607  0.031652155  0.003074379  0.016247332 
#>      numbers     addition 
#>  0.035000510 -0.010817083
sw$T_diff
#>        poetry           art         dance    literature         novel 
#> -0.0265718087  0.0054876842 -0.0523231481 -0.0117847993 -0.0369267966 
#>      symphony         drama     sculpture 
#>  0.0224587349 -0.0167662057  0.0003334358

Created on 2022-01-27 by the reprex package (v2.0.1)