kita 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +13 -0
  5. data/CHANGELOG.md +15 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +8 -0
  8. data/Gemfile.lock +120 -0
  9. data/README.md +1 -0
  10. data/Rakefile +8 -0
  11. data/bin/kita +11 -0
  12. data/kita.gemspec +35 -0
  13. data/lib/kita.rb +160 -0
  14. data/lib/kita/audio.rb +33 -0
  15. data/lib/kita/config.rb +8 -0
  16. data/lib/kita/hiragana.rb +59 -0
  17. data/lib/kita/katakana.rb +59 -0
  18. data/lib/kita/version.rb +5 -0
  19. data/snapcraft.yaml +18 -0
  20. data/sounds/he.ogg +0 -0
  21. data/sounds/he2.ogg +0 -0
  22. data/sounds/tofix.txt +2 -0
  23. data/sounds//343/201/202.ogg +0 -0
  24. data/sounds//343/201/2022.ogg +0 -0
  25. data/sounds//343/201/204.ogg +0 -0
  26. data/sounds//343/201/2042.ogg +0 -0
  27. data/sounds//343/201/206.ogg +0 -0
  28. data/sounds//343/201/2062.ogg +0 -0
  29. data/sounds//343/201/210.ogg +0 -0
  30. data/sounds//343/201/2102.ogg +0 -0
  31. data/sounds//343/201/212.ogg +0 -0
  32. data/sounds//343/201/2122.ogg +0 -0
  33. data/sounds//343/201/213.ogg +0 -0
  34. data/sounds//343/201/2132.ogg +0 -0
  35. data/sounds//343/201/214.ogg +0 -0
  36. data/sounds//343/201/2142.ogg +0 -0
  37. data/sounds//343/201/215.ogg +0 -0
  38. data/sounds//343/201/2152.ogg +0 -0
  39. data/sounds//343/201/216.ogg +0 -0
  40. data/sounds//343/201/2162.ogg +0 -0
  41. data/sounds//343/201/217.ogg +0 -0
  42. data/sounds//343/201/2172.ogg +0 -0
  43. data/sounds//343/201/220.ogg +0 -0
  44. data/sounds//343/201/2202.ogg +0 -0
  45. data/sounds//343/201/221.ogg +0 -0
  46. data/sounds//343/201/2212.ogg +0 -0
  47. data/sounds//343/201/222.ogg +0 -0
  48. data/sounds//343/201/2222.ogg +0 -0
  49. data/sounds//343/201/223.ogg +0 -0
  50. data/sounds//343/201/2232.ogg +0 -0
  51. data/sounds//343/201/223/343/202/214/343/201/257/345/214/227/343/201/247/343/201/231.ogg +0 -0
  52. data/sounds//343/201/224.ogg +0 -0
  53. data/sounds//343/201/2242.ogg +0 -0
  54. data/sounds//343/201/225.ogg +0 -0
  55. data/sounds//343/201/2252.ogg +0 -0
  56. data/sounds//343/201/226.ogg +0 -0
  57. data/sounds//343/201/2262.ogg +0 -0
  58. data/sounds//343/201/227.ogg +0 -0
  59. data/sounds//343/201/2272.ogg +0 -0
  60. data/sounds//343/201/230.ogg +0 -0
  61. data/sounds//343/201/2302.ogg +0 -0
  62. data/sounds//343/201/231.ogg +0 -0
  63. data/sounds//343/201/2312.ogg +0 -0
  64. data/sounds//343/201/232.ogg +0 -0
  65. data/sounds//343/201/2322.ogg +0 -0
  66. data/sounds//343/201/233.ogg +0 -0
  67. data/sounds//343/201/2332.ogg +0 -0
  68. data/sounds//343/201/234.ogg +0 -0
  69. data/sounds//343/201/2342.ogg +0 -0
  70. data/sounds//343/201/235.ogg +0 -0
  71. data/sounds//343/201/2352.ogg +0 -0
  72. data/sounds//343/201/236.ogg +0 -0
  73. data/sounds//343/201/2362.ogg +0 -0
  74. data/sounds//343/201/237.ogg +0 -0
  75. data/sounds//343/201/2372.ogg +0 -0
  76. data/sounds//343/201/240.ogg +0 -0
  77. data/sounds//343/201/2402.ogg +0 -0
  78. data/sounds//343/201/241.ogg +0 -0
  79. data/sounds//343/201/2412.ogg +0 -0
  80. data/sounds//343/201/242.ogg +0 -0
  81. data/sounds//343/201/2422.ogg +0 -0
  82. data/sounds//343/201/244.ogg +0 -0
  83. data/sounds//343/201/2442.ogg +0 -0
  84. data/sounds//343/201/245.ogg +0 -0
  85. data/sounds//343/201/2452.ogg +0 -0
  86. data/sounds//343/201/246.ogg +0 -0
  87. data/sounds//343/201/2462.ogg +0 -0
  88. data/sounds//343/201/247.ogg +0 -0
  89. data/sounds//343/201/2472.ogg +0 -0
  90. data/sounds//343/201/250.ogg +0 -0
  91. data/sounds//343/201/2502.ogg +0 -0
  92. data/sounds//343/201/251.ogg +0 -0
  93. data/sounds//343/201/2512.ogg +0 -0
  94. data/sounds//343/201/252.ogg +0 -0
  95. data/sounds//343/201/2522.ogg +0 -0
  96. data/sounds//343/201/253.ogg +0 -0
  97. data/sounds//343/201/2532.ogg +0 -0
  98. data/sounds//343/201/254.ogg +0 -0
  99. data/sounds//343/201/2542.ogg +0 -0
  100. data/sounds//343/201/255.ogg +0 -0
  101. data/sounds//343/201/2552.ogg +0 -0
  102. data/sounds//343/201/256.ogg +0 -0
  103. data/sounds//343/201/2562.ogg +0 -0
  104. data/sounds//343/201/257.ogg +0 -0
  105. data/sounds//343/201/2572.ogg +0 -0
  106. data/sounds//343/201/260.ogg +0 -0
  107. data/sounds//343/201/2602.ogg +0 -0
  108. data/sounds//343/201/261.ogg +0 -0
  109. data/sounds//343/201/2612.ogg +0 -0
  110. data/sounds//343/201/262.ogg +0 -0
  111. data/sounds//343/201/2622.ogg +0 -0
  112. data/sounds//343/201/263.ogg +0 -0
  113. data/sounds//343/201/2632.ogg +0 -0
  114. data/sounds//343/201/264.ogg +0 -0
  115. data/sounds//343/201/2642.ogg +0 -0
  116. data/sounds//343/201/265.ogg +0 -0
  117. data/sounds//343/201/2652.ogg +0 -0
  118. data/sounds//343/201/266.ogg +0 -0
  119. data/sounds//343/201/2662.ogg +0 -0
  120. data/sounds//343/201/267.ogg +0 -0
  121. data/sounds//343/201/2672.ogg +0 -0
  122. data/sounds//343/201/270.ogg +0 -0
  123. data/sounds//343/201/2702.ogg +0 -0
  124. data/sounds//343/201/271.ogg +0 -0
  125. data/sounds//343/201/2712.ogg +0 -0
  126. data/sounds//343/201/272.ogg +0 -0
  127. data/sounds//343/201/2722.ogg +0 -0
  128. data/sounds//343/201/273.ogg +0 -0
  129. data/sounds//343/201/2732.ogg +0 -0
  130. data/sounds//343/201/274.ogg +0 -0
  131. data/sounds//343/201/2742.ogg +0 -0
  132. data/sounds//343/201/275.ogg +0 -0
  133. data/sounds//343/201/2752.ogg +0 -0
  134. data/sounds//343/201/276.ogg +0 -0
  135. data/sounds//343/201/2762.ogg +0 -0
  136. data/sounds//343/201/277.ogg +0 -0
  137. data/sounds//343/201/2772.ogg +0 -0
  138. data/sounds//343/202/200.ogg +0 -0
  139. data/sounds//343/202/2002.ogg +0 -0
  140. data/sounds//343/202/201.ogg +0 -0
  141. data/sounds//343/202/2012.ogg +0 -0
  142. data/sounds//343/202/202.ogg +0 -0
  143. data/sounds//343/202/2022.ogg +0 -0
  144. data/sounds//343/202/204.ogg +0 -0
  145. data/sounds//343/202/2042.ogg +0 -0
  146. data/sounds//343/202/206.ogg +0 -0
  147. data/sounds//343/202/2062.ogg +0 -0
  148. data/sounds//343/202/210.ogg +0 -0
  149. data/sounds//343/202/2102.ogg +0 -0
  150. data/sounds//343/202/211.ogg +0 -0
  151. data/sounds//343/202/2112.ogg +0 -0
  152. data/sounds//343/202/212.ogg +0 -0
  153. data/sounds//343/202/2122.ogg +0 -0
  154. data/sounds//343/202/213.ogg +0 -0
  155. data/sounds//343/202/2132.ogg +0 -0
  156. data/sounds//343/202/214.ogg +0 -0
  157. data/sounds//343/202/2142.ogg +0 -0
  158. data/sounds//343/202/215.ogg +0 -0
  159. data/sounds//343/202/2152.ogg +0 -0
  160. data/sounds//343/202/217.ogg +0 -0
  161. data/sounds//343/202/2172.ogg +0 -0
  162. data/sounds//343/202/222.ogg +0 -0
  163. data/sounds//343/202/2222.ogg +0 -0
  164. data/sounds//343/202/223.ogg +0 -0
  165. data/sounds//343/202/2232.ogg +0 -0
  166. data/test-notify.rb +33 -0
  167. data/ui/builder.ui +384 -0
  168. data/ui/kita.svg +137 -0
  169. metadata +297 -0
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gst'
4
+
5
+ # Initialise Gstreamer for sounds
6
+ class Audio
7
+ def initialize
8
+ setup_gst
9
+ end
10
+
11
+ def setup_gst
12
+ Gst.init
13
+ @playbin = Gst::ElementFactory.make('playbin3')
14
+
15
+ @playbin.bus.add_watch do |_bus, message|
16
+ case message.type
17
+ when Gst::MessageType::EOS
18
+ @playbin.stop
19
+ end
20
+ end
21
+ end
22
+
23
+ def play(uri)
24
+ @playbin.stop
25
+ @playbin.uri = Gst.filename_to_uri("./sounds/#{uri}.ogg")
26
+ @playbin.play
27
+ end
28
+
29
+ def repeat
30
+ @playbin.stop
31
+ @playbin.play
32
+ end
33
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'config'
4
+
5
+ Config.load_and_set_settings(Config.setting_files('~/kita.yaml', 'kita'))
6
+ Settings.speak = true
7
+ Settings.hiragana = true
8
+ Settings.katakana = false
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mojinizer'
4
+
5
+ HIRAGANA = %w[
6
+ あ い う え お
7
+ か き く け こ
8
+ が ぎ ぐ げ ご
9
+ さ し す せ そ
10
+ ざ じ ず ぜ ぞ
11
+ た ち つ て と
12
+ だ ぢ づ で ど
13
+ な に ぬ ね の
14
+ は ひ ふ へ ほ
15
+ ば び ぶ べ ぼ
16
+ ぱ ぴ ぷ ぺ ぽ
17
+ ま み む め も
18
+ や ゆ よ
19
+ ら り る れ ろ
20
+ わ を
21
+
22
+ ].freeze
23
+
24
+ # Hiragana Class
25
+ class Hiragana
26
+ def initialize
27
+ @previous = []
28
+ end
29
+
30
+ def question
31
+ # Keep selecting a new character at random until it's
32
+ # different to any in the 'previous' array
33
+ chars = HIRAGANA.sample(4)
34
+ chars = HIRAGANA.sample(4) while @previous.include? chars[0]
35
+ question = build_question(chars)
36
+ # Log character to ensure no character from the last 10 is repeated
37
+ log_character(chars[0])
38
+ question
39
+ end
40
+
41
+ private
42
+
43
+ def log_character(character)
44
+ @previous.shift if @previous.size > 9
45
+ @previous.push character
46
+ end
47
+
48
+ def build_question(chars)
49
+ {
50
+ question: chars[0],
51
+ answer: chars[0].romaji,
52
+ choices: [
53
+ chars[1].romaji,
54
+ chars[2].romaji,
55
+ chars[3].romaji
56
+ ]
57
+ }
58
+ end
59
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mojinizer'
4
+
5
+ KATAKANA = %w[
6
+ ア イ ウ エ オ
7
+ カ キ ク ケ コ
8
+ ガ ギ グ ゲ ゴ
9
+ サ シ ス セ ソ
10
+ ザ ジ ズ ゼ ゾ
11
+ タ チ ツ テ ト
12
+ ダ ヂ ヅ デ ド
13
+ ナ ニ ヌ ネ ノ
14
+ ハ ヒ フ ヘ ホ
15
+ バ ビ ブ ベ ボ
16
+ パ ピ プ ペ ポ
17
+ マ ミ ム メ モ
18
+ ヤ ユ ヨ
19
+ ラ リ ル レ ロ
20
+ ワ ヲ
21
+
22
+ ].freeze
23
+
24
+ # Katakana Class
25
+ class Katakana
26
+ def initialize
27
+ @previous = []
28
+ end
29
+
30
+ def question
31
+ # Keep selecting a new character at random until it's
32
+ # different to any in the 'previous' array
33
+ chars = KATAKANA.sample(4)
34
+ chars = KATAKANA.sample(4) while @previous.include? chars[0]
35
+ question = build_question(chars)
36
+ # Log character to ensure no character from the last 10 is repeated
37
+ log_character(chars[0])
38
+ question
39
+ end
40
+
41
+ private
42
+
43
+ def log_character(character)
44
+ @previous.shift if @previous.size > 9
45
+ @previous.push character
46
+ end
47
+
48
+ def build_question(chars)
49
+ {
50
+ question: chars[0],
51
+ answer: chars[0].hiragana,
52
+ choices: [
53
+ chars[1].hiragana,
54
+ chars[2].hiragana,
55
+ chars[3].hiragana
56
+ ]
57
+ }
58
+ end
59
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kita
4
+ VERSION = '0.5.1'
5
+ end
@@ -0,0 +1,18 @@
1
+ name: kita
2
+ version: "0.5.0"
3
+ summary: Japanese learning tool
4
+ description: |
5
+ A simple tool to help Japanese language learners.
6
+
7
+ confinement: devmode
8
+ base: core18
9
+
10
+ parts:
11
+ kita:
12
+ source: .
13
+ plugin: ruby
14
+ gems:
15
+ - kita
16
+ apps:
17
+ kita:
18
+ command: bin/kita
Binary file
Binary file
@@ -0,0 +1,2 @@
1
+ su
2
+ he - pronounced as particle (e)
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file