How to unzip and extract text form a downloaded corpus in zip

I think this approach works well so far:

The bulk of the code is:

d3
    .buffer('https://cors-anywhere.herokuapp.com/' + 'https://github.com/nltk/nltk_data/raw/gh-pages/packages/corpora/abc.zip')
    .then(arrayBuffer=> { 
        let zip = JSZip();
        return zip.loadAsync(arrayBuffer);
    })
    .then(zip=>{
      return zip.file(`abc/${abc_rural_science_choice}.txt`).async('string');
    })
1 Like