SHARE
TWEET

Untitled

a guest Jun 17th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  *
  3.  * This script removes the English readings from the JMDict dictionary file used
  4.  * by Yomichan. Using this lets you get the JMDict frequency information without
  5.  * the English dictionary definitions.
  6.  *
  7.  * Pass the filename in as a command line argument.
  8.  *
  9.  * Usage:
  10.  *
  11.  *  1. Download the JMDict zip file from the Yomichan website
  12.  *  2. Unzip it
  13.  *  3. Run all the term_bank files through this script and replace the output
  14.  *     with the original file
  15.  *  4. Zip everything back up
  16.  *  5. Load the new zip file into Yomichan
  17.  *
  18.  **/
  19. const fs = require('fs');
  20.  
  21. // get filename from command line arg
  22. const filename = process.argv[2];
  23.  
  24. // read file
  25. const json = JSON.parse(fs.readFileSync(filename, 'utf8'));
  26.  
  27. // get rid of english definitions
  28. json.forEach(e => e[5] = []);
  29.  
  30. // print back out
  31. console.log(JSON.stringify(json));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top