kdpsingh / clinspacy

Clinical Natural Language Processing using spaCy, scispacy, and medspacy
Other
96 stars 19 forks source link

Error using bind_clinspacy() without linker #3

Closed drjgauthier closed 4 years ago

drjgauthier commented 4 years ago

I get the following error message when trying to run the example code:

mtsamples_with_cuis = bind_clinspacy(mtsamples[1:5,], text="description") Error in if (clinspacy_env$use_linker) { : argument is of length zero

The same code works after activating the linker with clinspacy_init()

Details about my OS/R: platform arch os system status major minor year month day svn.rev language version.string nickname
x86_64-apple-darwin17.0 x86_64 darwin17.0 x86_64, darwin17.0 4 0.2 2020 06 22 78730 R R version 4.0.2 (2020-06-22) Taking Off Again
kdpsingh commented 4 years ago

Thanks for catching this! It's an easy fix. Will take care of it soon.

It has to do with the fact that the use_linker flag is NULL prior to clinspacy_init(). So instead of checking to see if it is TRUE/FALSE, I first need to check if it is NULL. This works properly with embeddings but not in bind_clinspacy().

A workaround for now (as you mention) is to first run clinspacy_init() either by itself or with a T/F value set to the use_linker argument. The default is to not use the linker so use of the linker isn't required.

kdpsingh commented 4 years ago

Fixed in https://github.com/ML4LHS/clinspacy/commit/4177a560cacb3eb52a466b7f0e022397739db1d3. Feel free to install the latest version.