Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with textmodel_affinity function #1338

Closed
omstuhler opened this issue May 7, 2018 · 1 comment
Closed

Problem with textmodel_affinity function #1338

omstuhler opened this issue May 7, 2018 · 1 comment

Comments

@omstuhler
Copy link

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.

@kbenoit kbenoit closed this as completed in f0159b6 May 7, 2018
@kbenoit
Copy link
Collaborator

kbenoit commented May 7, 2018

Thanks, this was a simple bug, now fixed in current master branch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants