kita 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +15 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +120 -0
- data/README.md +1 -0
- data/Rakefile +8 -0
- data/bin/kita +11 -0
- data/kita.gemspec +35 -0
- data/lib/kita.rb +160 -0
- data/lib/kita/audio.rb +33 -0
- data/lib/kita/config.rb +8 -0
- data/lib/kita/hiragana.rb +59 -0
- data/lib/kita/katakana.rb +59 -0
- data/lib/kita/version.rb +5 -0
- data/snapcraft.yaml +18 -0
- data/sounds/he.ogg +0 -0
- data/sounds/he2.ogg +0 -0
- data/sounds/tofix.txt +2 -0
- data/sounds//343/201/202.ogg +0 -0
- data/sounds//343/201/2022.ogg +0 -0
- data/sounds//343/201/204.ogg +0 -0
- data/sounds//343/201/2042.ogg +0 -0
- data/sounds//343/201/206.ogg +0 -0
- data/sounds//343/201/2062.ogg +0 -0
- data/sounds//343/201/210.ogg +0 -0
- data/sounds//343/201/2102.ogg +0 -0
- data/sounds//343/201/212.ogg +0 -0
- data/sounds//343/201/2122.ogg +0 -0
- data/sounds//343/201/213.ogg +0 -0
- data/sounds//343/201/2132.ogg +0 -0
- data/sounds//343/201/214.ogg +0 -0
- data/sounds//343/201/2142.ogg +0 -0
- data/sounds//343/201/215.ogg +0 -0
- data/sounds//343/201/2152.ogg +0 -0
- data/sounds//343/201/216.ogg +0 -0
- data/sounds//343/201/2162.ogg +0 -0
- data/sounds//343/201/217.ogg +0 -0
- data/sounds//343/201/2172.ogg +0 -0
- data/sounds//343/201/220.ogg +0 -0
- data/sounds//343/201/2202.ogg +0 -0
- data/sounds//343/201/221.ogg +0 -0
- data/sounds//343/201/2212.ogg +0 -0
- data/sounds//343/201/222.ogg +0 -0
- data/sounds//343/201/2222.ogg +0 -0
- data/sounds//343/201/223.ogg +0 -0
- data/sounds//343/201/2232.ogg +0 -0
- data/sounds//343/201/223/343/202/214/343/201/257/345/214/227/343/201/247/343/201/231.ogg +0 -0
- data/sounds//343/201/224.ogg +0 -0
- data/sounds//343/201/2242.ogg +0 -0
- data/sounds//343/201/225.ogg +0 -0
- data/sounds//343/201/2252.ogg +0 -0
- data/sounds//343/201/226.ogg +0 -0
- data/sounds//343/201/2262.ogg +0 -0
- data/sounds//343/201/227.ogg +0 -0
- data/sounds//343/201/2272.ogg +0 -0
- data/sounds//343/201/230.ogg +0 -0
- data/sounds//343/201/2302.ogg +0 -0
- data/sounds//343/201/231.ogg +0 -0
- data/sounds//343/201/2312.ogg +0 -0
- data/sounds//343/201/232.ogg +0 -0
- data/sounds//343/201/2322.ogg +0 -0
- data/sounds//343/201/233.ogg +0 -0
- data/sounds//343/201/2332.ogg +0 -0
- data/sounds//343/201/234.ogg +0 -0
- data/sounds//343/201/2342.ogg +0 -0
- data/sounds//343/201/235.ogg +0 -0
- data/sounds//343/201/2352.ogg +0 -0
- data/sounds//343/201/236.ogg +0 -0
- data/sounds//343/201/2362.ogg +0 -0
- data/sounds//343/201/237.ogg +0 -0
- data/sounds//343/201/2372.ogg +0 -0
- data/sounds//343/201/240.ogg +0 -0
- data/sounds//343/201/2402.ogg +0 -0
- data/sounds//343/201/241.ogg +0 -0
- data/sounds//343/201/2412.ogg +0 -0
- data/sounds//343/201/242.ogg +0 -0
- data/sounds//343/201/2422.ogg +0 -0
- data/sounds//343/201/244.ogg +0 -0
- data/sounds//343/201/2442.ogg +0 -0
- data/sounds//343/201/245.ogg +0 -0
- data/sounds//343/201/2452.ogg +0 -0
- data/sounds//343/201/246.ogg +0 -0
- data/sounds//343/201/2462.ogg +0 -0
- data/sounds//343/201/247.ogg +0 -0
- data/sounds//343/201/2472.ogg +0 -0
- data/sounds//343/201/250.ogg +0 -0
- data/sounds//343/201/2502.ogg +0 -0
- data/sounds//343/201/251.ogg +0 -0
- data/sounds//343/201/2512.ogg +0 -0
- data/sounds//343/201/252.ogg +0 -0
- data/sounds//343/201/2522.ogg +0 -0
- data/sounds//343/201/253.ogg +0 -0
- data/sounds//343/201/2532.ogg +0 -0
- data/sounds//343/201/254.ogg +0 -0
- data/sounds//343/201/2542.ogg +0 -0
- data/sounds//343/201/255.ogg +0 -0
- data/sounds//343/201/2552.ogg +0 -0
- data/sounds//343/201/256.ogg +0 -0
- data/sounds//343/201/2562.ogg +0 -0
- data/sounds//343/201/257.ogg +0 -0
- data/sounds//343/201/2572.ogg +0 -0
- data/sounds//343/201/260.ogg +0 -0
- data/sounds//343/201/2602.ogg +0 -0
- data/sounds//343/201/261.ogg +0 -0
- data/sounds//343/201/2612.ogg +0 -0
- data/sounds//343/201/262.ogg +0 -0
- data/sounds//343/201/2622.ogg +0 -0
- data/sounds//343/201/263.ogg +0 -0
- data/sounds//343/201/2632.ogg +0 -0
- data/sounds//343/201/264.ogg +0 -0
- data/sounds//343/201/2642.ogg +0 -0
- data/sounds//343/201/265.ogg +0 -0
- data/sounds//343/201/2652.ogg +0 -0
- data/sounds//343/201/266.ogg +0 -0
- data/sounds//343/201/2662.ogg +0 -0
- data/sounds//343/201/267.ogg +0 -0
- data/sounds//343/201/2672.ogg +0 -0
- data/sounds//343/201/270.ogg +0 -0
- data/sounds//343/201/2702.ogg +0 -0
- data/sounds//343/201/271.ogg +0 -0
- data/sounds//343/201/2712.ogg +0 -0
- data/sounds//343/201/272.ogg +0 -0
- data/sounds//343/201/2722.ogg +0 -0
- data/sounds//343/201/273.ogg +0 -0
- data/sounds//343/201/2732.ogg +0 -0
- data/sounds//343/201/274.ogg +0 -0
- data/sounds//343/201/2742.ogg +0 -0
- data/sounds//343/201/275.ogg +0 -0
- data/sounds//343/201/2752.ogg +0 -0
- data/sounds//343/201/276.ogg +0 -0
- data/sounds//343/201/2762.ogg +0 -0
- data/sounds//343/201/277.ogg +0 -0
- data/sounds//343/201/2772.ogg +0 -0
- data/sounds//343/202/200.ogg +0 -0
- data/sounds//343/202/2002.ogg +0 -0
- data/sounds//343/202/201.ogg +0 -0
- data/sounds//343/202/2012.ogg +0 -0
- data/sounds//343/202/202.ogg +0 -0
- data/sounds//343/202/2022.ogg +0 -0
- data/sounds//343/202/204.ogg +0 -0
- data/sounds//343/202/2042.ogg +0 -0
- data/sounds//343/202/206.ogg +0 -0
- data/sounds//343/202/2062.ogg +0 -0
- data/sounds//343/202/210.ogg +0 -0
- data/sounds//343/202/2102.ogg +0 -0
- data/sounds//343/202/211.ogg +0 -0
- data/sounds//343/202/2112.ogg +0 -0
- data/sounds//343/202/212.ogg +0 -0
- data/sounds//343/202/2122.ogg +0 -0
- data/sounds//343/202/213.ogg +0 -0
- data/sounds//343/202/2132.ogg +0 -0
- data/sounds//343/202/214.ogg +0 -0
- data/sounds//343/202/2142.ogg +0 -0
- data/sounds//343/202/215.ogg +0 -0
- data/sounds//343/202/2152.ogg +0 -0
- data/sounds//343/202/217.ogg +0 -0
- data/sounds//343/202/2172.ogg +0 -0
- data/sounds//343/202/222.ogg +0 -0
- data/sounds//343/202/2222.ogg +0 -0
- data/sounds//343/202/223.ogg +0 -0
- data/sounds//343/202/2232.ogg +0 -0
- data/test-notify.rb +33 -0
- data/ui/builder.ui +384 -0
- data/ui/kita.svg +137 -0
- metadata +297 -0
data/lib/kita/audio.rb
ADDED
|
@@ -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
|
data/lib/kita/config.rb
ADDED
|
@@ -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
|
data/lib/kita/version.rb
ADDED
data/snapcraft.yaml
ADDED
|
@@ -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
|
data/sounds/he.ogg
ADDED
|
Binary file
|
data/sounds/he2.ogg
ADDED
|
Binary file
|
data/sounds/tofix.txt
ADDED
|
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
|
|
Binary file
|