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

RegEx Issue in parse() #38

Open
gabrielodom opened this issue Jun 15, 2021 · 3 comments
Open

RegEx Issue in parse() #38

gabrielodom opened this issue Jun 15, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@gabrielodom
Copy link
Contributor

Consider the following example:

sentence <- 'I had "a bunch" of coke.'

The regular expression fails to remove these quotation marks before matching against stop words. Thus, "a" is still included in the output of parse().

@gabrielodom gabrielodom added the bug Something isn't working label Jun 15, 2021
@gabrielodom
Copy link
Contributor Author

Also, the function discards all output if "Bup/Nx" is included in the string.

@gabrielodom
Copy link
Contributor Author

gabrielodom commented Jun 15, 2021

gabrielodom added a commit that referenced this issue Jun 15, 2021
@gabrielodom gabrielodom reopened this Jul 13, 2021
@gabrielodom
Copy link
Contributor Author

Another issue:
If I call lookup(m-CAT) (for mephedrone), I get

  original_word     class            category synonym
1         m-cat stimulant synthetic cathinone   m-cat

However, when we put this word in a sentence:

> lookup(parse("try some m-CAT my friend"))
  original_word             class category synonym
1        friend narcotic (opioid) fentanyl  friend

The parse() function removes m-CAT because of the hyphen. Additionally, even if parse() just removed the hyphen and left mCAT or mcat, lookup(mcat) returns NAs. In fact, there are 129 slang terms which contain - in their strings. Our current framework for parse() would fail to match these drugs. Code to find the 129 drugs mentioned:

DOPE::lookup_df %>% filter(str_detect(synonym, pattern = "-"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants