semaxis | R Documentation |
This function calculates the axis and the score using the SemAxis framework proposed in An et al (2018). If possible, please use query()
instead.
semaxis(w, S_words, A_words, B_words, l = 0, verbose = FALSE)
w |
a numeric matrix of word embeddings, e.g. from |
S_words |
a character vector of the first set of target words. In an example of studying gender stereotype, it can include occupations such as programmer, engineer, scientists... |
A_words |
a character vector of the first set of attribute words. In an example of studying gender stereotype, it can include words such as man, male, he, his. |
B_words |
a character vector of the second set of attribute words. In an example of studying gender stereotype, it can include words such as woman, female, she, her. |
l |
an integer indicates the number of words to augment each word in A and B based on cosine , see An et al (2018). Default to 0 (no augmentation). |
verbose |
logical, whether to display information |
A list with class "semaxis"
containing the following components:
$P
for each of words in S, the score according to SemAxis
$V
the semantic axis vector
$S_words
the input S_words
$A_words
the input A_words
$B_words
the input B_words
An, J., Kwak, H., & Ahn, Y. Y. (2018). SemAxis: A lightweight framework to characterize domain-specific word semantics beyond sentiment. arXiv preprint arXiv:1806.05521.
data(glove_math)
S1 <- c("math", "algebra", "geometry", "calculus", "equations",
"computation", "numbers", "addition")
A1 <- c("male", "man", "boy", "brother", "he", "him", "his", "son")
B1 <- c("female", "woman", "girl", "sister", "she", "her", "hers", "daughter")
semaxis(glove_math, S1, A1, B1, l = 0)$P
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.