Skip to content

thesaurus function breaks if a key has no feature match  #115

Description

@kbenoit

a problem with applyDictionary(), example:

mydict <- dictionary(list(nonExistent = c("XXX", "YYY")))
mydfm <- dfm(inaugCorpus, dictionary = mydict)
Creating a dfm from a corpus ...
  ... lowercasing
  ... tokenizing
  ... indexing documents: 57 documents
  ... indexing features: 9,215 feature types
  ... applying a dictionary consisting of 1 key
  ... created a 57 x 1 sparse dfm
  ... complete. 
Elapsed time: 0.115 seconds.
topfeatures(mydfm)
nonExistent 
         0 
mydfm <- dfm(inaugCorpus, thesaurus = mydict)
Creating a dfm from a corpus ...
  ... lowercasing
  ... tokenizing
  ... indexing documents: 57 documents
  ... indexing features: 9,215 feature types
  ... applying a dictionary consisting of 1 key
Show Traceback

Rerun with Debug
Error in -keyIndex : invalid argument to unary operator 

Thanks Luc Frachon luc.frachon@gmail.com for discovering this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions