EmilHvitfeldt / textdata

Download, parse, store, and load text datasets instead of storing it in packages
https://emilhvitfeldt.github.io/textdata/
Other
75 stars 13 forks source link

lexicon_nrc() appears broken again #52

Closed KyleOfCanada closed 2 years ago

KyleOfCanada commented 2 years ago

It looks like the structural change in the source file that led to issue #50 has been rolled back, so lexicon_nrc() fails due to a missing file.

I think the path used in process_nrc() should once again be: "NRC-Emotion-Lexicon/NRC-Emotion-Lexicon-v0.92/NRC-Emotion-Lexicon-Wordlevel-v0.92.txt"

EmilHvitfeldt commented 2 years ago

Hello @KyleOfCanada 👋 I'm not able to reproduce this error, are you sure you are using the most up to date version of textdata (0.4.4)?

tmp_file <- tempfile()
tmp_dir <- tempdir()

download.file(
  "http://saifmohammad.com/WebDocs/Lexicons/NRC-Emotion-Lexicon.zip", 
  destfile = tmp_file
)

unzip(tmp_file, exdir = tmp_dir)

fs::dir_ls(fs::path(tmp_dir, "NRC-Emotion-Lexicon"))
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/ListOfLanguages-For-Which-Lexicon-Availabale.txt
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/NRC-Emotion-Lexicon-ForVariousLanguages.txt
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/NRC-Emotion-Lexicon-Senselevel-v0.92.txt
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/NRC-Emotion-Lexicon-Wordlevel-v0.92.txt
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/OneFilePerEmotion
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/OneFilePerLanguage
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/Paper-Ethics-Sheet-Emotion-Recognition.pdf
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/Paper-Practical-Ethical-Considerations-Lexicons.pdf
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/Paper1_NRC_Emotion_Lexicon.pdf
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/Paper2_NRC_Emotion_Lexicon.pdf
#> /var/folders/t2/yn6r1mw93lq0r_2937fvjzbm0000gn/T/RtmpQoyhMe/NRC-Emotion-Lexicon/README.txt

Created on 2022-09-16 by the reprex package (v2.0.1)

KyleOfCanada commented 2 years ago

Hi @EmilHvitfeldt, I figured out what was causing the error. I was downloading the .zip file from a slightly different link:

"http://saifmohammad.com/WebDocs/NRC-Emotion-Lexicon.zip"

instead of:

"http://saifmohammad.com/WebDocs/Lexicons/NRC-Emotion-Lexicon.zip"

The link I was using still has the old version of the .zip file and this was what caused my error.

Sorry for the trouble.