First of all, thank you for developing this excellent package! Today I encountered what might be a bug of the new textmodel_affinity function.
When running:
tma <- textmodel_affinity(dfm(data_corpus_inaugural, tolower = T), y = c("Govt", "Opp", "Opp", rep(NA, 55)))
tma <- textmodel_affinity(dfm(data_corpus_inaugural, tolower = F), y = c("Govt", "Opp", "Opp", rep(NA, 55)))
The former runs through while the latter produces the error NROW(x) == ncat is not TRUE.
I traced this problem further and it appears that textmodel_affinity crashes when there are tokens with an identical composition of letters but different cases:
tma <- textmodel_affinity(dfm(c("A", "B", "C", "a"), tolower = T), y = c("one", "two", NA, NA))
tma <- textmodel_affinity(dfm(c("A", "B", "C", "a"), tolower = F), y = c("one", "two", NA, NA))
Here, again, the latter leads to NROW(x) == ncat is not TRUE.
First of all, thank you for developing this excellent package! Today I encountered what might be a bug of the new
textmodel_affinityfunction.When running:
The former runs through while the latter produces the error
NROW(x) == ncat is not TRUE.I traced this problem further and it appears that
textmodel_affinitycrashes when there are tokens with an identical composition of letters but different cases:Here, again, the latter leads to
NROW(x) == ncat is not TRUE.