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

Ensure dfm_lookup returns dfm with all the keys #1946

Merged
merged 2 commits into from
May 11, 2020
Merged

Conversation

koheiw
Copy link
Collaborator

@koheiw koheiw commented May 11, 2020

This is a major bug. dfm_lookup() returns a dfm without columns when there is no matches.

> toks <- tokens(c("aaaa aaaa", "bbbb"))
> dfmt <- dfm(toks)
> dfm(tokens_lookup(toks, dict)) # Correct
Document-feature matrix of: 2 documents, 2 features (100.0% sparse).
       features
docs    key1 key2
  text1    0    0
  text2    0    0
> dfm_lookup(dfmt, dict) # Not (not features)
Document-feature matrix of: 2 documents, 0 features.

@koheiw koheiw requested a review from kbenoit May 11, 2020 14:36
@codecov
Copy link

codecov bot commented May 11, 2020

Codecov Report

Merging #1946 into master will decrease coverage by 0.01%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master    #1946      +/-   ##
==========================================
- Coverage   91.27%   91.26%   -0.02%     
==========================================
  Files         100      100              
  Lines        6318     6319       +1     
==========================================
  Hits         5767     5767              
- Misses        551      552       +1     

Copy link
Collaborator

@kbenoit kbenoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly I noticed this too today, when working on the sentiment branch!

@koheiw
Copy link
Collaborator Author

koheiw commented May 11, 2020

I noticed this today when I was working on #1912

@kbenoit kbenoit merged commit 9e8a98d into master May 11, 2020
@kbenoit kbenoit deleted the fix-dfm_lookup branch May 11, 2020 18:19
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

Successfully merging this pull request may close these issues.

None yet

2 participants