Advertisement
Guest User

Simple Random Vocabulary System

a guest
Jan 27th, 2015
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.36 KB | None | 0 0
  1. import random as r
  2.  
  3. # Simple Random Vocabulary System
  4. # Get random words from a dictionary file
  5. # e.g. je_edict (japanese) or je_enamdict (chinese) etc.
  6. # available here
  7. # https://github.com/larsyencken/cjkdata/tree/master/cjkdata/dict
  8. # change paths as needed
  9. # Tested on : python 2.7.x
  10.  
  11. le='-'*30
  12.  
  13. print 'Edict\n'
  14. s=(r.sample(open("/dict/je_edict").readlines(),4))
  15. for x in s:
  16.   print(x.decode('utf8'))
  17. print le  
  18.  
  19. print 'EnameDict\n'
  20. s=(r.sample(open("/dict/je_enamdict").readlines(),4))
  21. for x in s:
  22.   print(x.decode('utf8'))  
  23. print le  
  24.  
  25. print 'J-PlacesDict\n'
  26. s=(r.sample(open("/dict/je_jplaces").readlines(),4))
  27. for x in s:
  28.   print(x.decode('utf8'))  
  29. print le  
  30.  
  31. print 'J-ComputerDict\n'
  32. s=(r.sample(open("/dict/je_compdic").readlines(),4))
  33. for x in s:
  34.   print(x.decode('utf8'))  
  35. print le  
  36.  
  37. print 'ChineseDict\n'
  38. s=(r.sample(open("/dict/ce_cedict").readlines(),4))
  39. for x in s:
  40.   print(x.decode('utf8'))  
  41. print le  
  42.  
  43. #####################################################################################################
  44. Sample output :
  45.  
  46.  
  47. ------------------------------
  48. Edict
  49.  
  50. ビジュアル・ノベル /(n) visual novel/
  51.  
  52. 心忙しい [こころぜわしい] /(adj-i) restless/
  53.  
  54. 楽器演奏者 [がっきえんそうしゃ] /(n) (musical) instrumentalist/
  55.  
  56. ウエストエンド /(n) West End/
  57.  
  58. ------------------------------
  59. EnameDict
  60.  
  61. タティアナ /(u) Tatiana/
  62.  
  63. 銀英 [ぎんえい] /Gin'ei (g)/
  64.  
  65. ホープカーク /(u) Hopekirk/
  66.  
  67. 公文 [くぶん] /Kubun (s)/
  68.  
  69. ------------------------------
  70. J-PlacesDict
  71.  
  72. 富川東 [とみかわひがし] /Tomikawahigashi (loc)/
  73.  
  74. 柳木 [やぎ] /Yagi (loc)/
  75.  
  76. 西幸町 [にしみゆきちょう] /Nishimiyukichou (loc)/
  77.  
  78. 棚井 [たない] /Tanai (loc)/
  79.  
  80. ------------------------------
  81. J-ComputerDict
  82.  
  83. ティーゾーン /(n) T-ZONE/
  84.  
  85. 格納メッセージ削除 [かくのうメッセージさくじょ] /(n) stored message deletion/MS/
  86.  
  87. 非アルファベット [ひアルファベット] /(n) non-alphabetic/non-alphanumeric/
  88.  
  89. 組合せ回路 [くみあわせかいろ] /(n) combinational circuit/
  90.  
  91. ------------------------------
  92. ChineseDict
  93.  
  94. 矮星 矮星 [ai3 xing1] /dwarf (star)/
  95.  
  96. 臇 臇 [juan3] /fat, rich/a stew of fish/
  97.  
  98. 九龍 九龙 [jiu3 long2] /Kowloon (Hong Kong)/
  99.  
  100. 鱎 鱎 [jiao3] /(fish)/
  101.  
  102. ------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement