learn-japanese 0.4.0 → 0.6.0
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 +4 -4
- data/.ruby-version +1 -0
- data/README.md +20 -12
- data/bin/learn-japanese +6 -0
- data/bin/sounds-to-hiragana +6 -0
- data/learn-japanese.gemspec +4 -3
- data/lib/learn-japanese/cli.rb +30 -0
- data/lib/learn-japanese/data/words.yaml +30 -3
- data/lib/learn-japanese/game/sound-game.rb +42 -0
- data/lib/learn-japanese/version.rb +3 -2
- data/lib/learn-japanese.rb +33 -0
- metadata +26 -6
- data/bin/sounds-to-hiragana.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d63b5f7f7aafa4c249290ead834bad949693cb156bb25f537fba3c0665211ab
|
4
|
+
data.tar.gz: 758f37922314566ac2e95a944428bbd6180de32df90549fad521037548c72cdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cd09b6001f729cbf395e3bf10eadc7e3a8a69a80d3201c1ef41290d3df67b120071cff1435566f857cf2a5678a5df6a59fb53e1e14fb313582cb52f90d0b738
|
7
|
+
data.tar.gz: 6ad71c8b31c20cb5a7196968ef58bf6f32b3f7e719bf7ac3d33d0cb8e2e8f31126166ad80c16ddff7224c6b8fe4a183c2d99d7469b95ebaffb0f7466f9f6eb7d
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.5
|
data/README.md
CHANGED
@@ -1,24 +1,32 @@
|
|
1
1
|
|
2
2
|
[](https://badge.fury.io/rb/learn-japanese)
|
3
3
|
|
4
|
-
#
|
4
|
+
# Learn Japanese
|
5
5
|
|
6
|
-
`learn-japanese`
|
7
|
-
De momento, sólo se está empezando a implementar la funcionalidad para aprender el Silabario Hiragana, pero poco a poco irá creciendo a medida que yo mismo aprenda más japonés.
|
6
|
+
`learn-japanese` helps us to learn japanese.
|
8
7
|
|
9
|
-
|
10
|
-
1. Debes tener Ruby instalado en tu equipo.
|
11
|
-
2. Abrir un terminal y ejecutar `sudo gem install learn-japanese`, para instalar la herramienta.
|
8
|
+
> WARNING: just only Hiragana (groups 1-4) for now.
|
12
9
|
|
13
|
-
|
10
|
+
Every few week will be grow with more functions... at the same time I'm learning too... I hope.
|
14
11
|
|
15
|
-
|
16
|
-
* Ejecutar `short-answer-game`, para el juego de preguntas donde debemos escribir la respuesta.
|
17
|
-
* Ejecutar `choose-answer-game`, para el juego de preguntas donde debemos elegir la respuesta correcta.
|
12
|
+
## Installation
|
18
13
|
|
19
|
-
|
14
|
+
1. Install Ruby on your system.
|
15
|
+
2. Open a terminal and run `sudo gem install learn-japanese`, to install the Ruby gem.
|
20
16
|
|
21
|
-
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
* Open a terminal and run `learn-japanese`.
|
20
|
+
|
21
|
+
## Functions or mini-games
|
22
|
+
|
23
|
+
| Function name | Description |
|
24
|
+
| ------------- | ---------------------------------------- |
|
25
|
+
| short-answer | Write the sound associated to the symbol |
|
26
|
+
| choose-answer | Choose the symbol associated to the sound |
|
27
|
+
| sound | Write the sounds and get the word |
|
28
|
+
|
29
|
+
# ANEXO
|
22
30
|
|
23
31
|
## Hiragana
|
24
32
|
|
data/bin/learn-japanese
ADDED
data/learn-japanese.gemspec
CHANGED
@@ -5,14 +5,15 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
|
5
5
|
name = "learn-japanese"
|
6
6
|
require "#{name}/version"
|
7
7
|
|
8
|
-
Gem::Specification.new name,
|
9
|
-
s.summary = "Learn Japanese (UNDER DEVELOPMENT
|
8
|
+
Gem::Specification.new name, LearnJapanese::VERSION do |s|
|
9
|
+
s.summary = "Learn Japanese (UNDER DEVELOPMENT)"
|
10
10
|
s.email = "dvarrui@protonmail.com"
|
11
|
-
s.homepage =
|
11
|
+
s.homepage = LearnJapanese::HOMEPAGE
|
12
12
|
s.authors = ["David Vargas Ruiz"]
|
13
13
|
s.files = `git ls-files`.split("\n")
|
14
14
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
15
|
s.license = "GPL-3"
|
16
16
|
|
17
17
|
s.add_runtime_dependency "colorize"
|
18
|
+
s.add_runtime_dependency "thor"
|
18
19
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require_relative '../learn-japanese'
|
3
|
+
|
4
|
+
class CLI < Thor
|
5
|
+
map ['h', '-h', '--help'] => 'help'
|
6
|
+
|
7
|
+
map ['v', '-v', '--version'] => 'version'
|
8
|
+
desc 'version', 'Show the program version'
|
9
|
+
def version
|
10
|
+
LearnJapanese.show_version
|
11
|
+
end
|
12
|
+
|
13
|
+
map ['ca', '-ca', '--choose-answer', 'choose-answer'] => 'choose_answer'
|
14
|
+
desc 'choose-answer [LEVEL]', 'LEVEL = 1-4'
|
15
|
+
def choose_answer(level)
|
16
|
+
LearnJapanese.choose_answer(level.to_i)
|
17
|
+
end
|
18
|
+
|
19
|
+
map ['sa', '-sa', '--short-answer', 'short-answer'] => 'short_answer'
|
20
|
+
desc 'short-answer [LEVEL]', 'LEVEL = 1-4'
|
21
|
+
def short_answer(level)
|
22
|
+
LearnJapanese.short_answer(level.to_i)
|
23
|
+
end
|
24
|
+
|
25
|
+
map ['so', '-so', '--sound', 'sound'] => 'sound'
|
26
|
+
desc 'sound', 'Write sounds and get the Hiragana'
|
27
|
+
def sound
|
28
|
+
LearnJapanese.sound
|
29
|
+
end
|
30
|
+
end
|
@@ -1,19 +1,46 @@
|
|
1
1
|
---
|
2
|
-
- sounds: e
|
3
|
-
hiragana: え
|
4
|
-
spanish: pintura
|
5
2
|
- sounds: ái
|
6
3
|
hiragana: あい
|
7
4
|
spanish: amor
|
5
|
+
- sounds: áka
|
6
|
+
hiragana: あか
|
7
|
+
spanish: rojo)
|
8
8
|
- sounds: áo
|
9
9
|
hiragana: あお
|
10
10
|
spanish: azul
|
11
|
+
- sounds: e
|
12
|
+
hiragana: え
|
13
|
+
spanish: pintura
|
14
|
+
- sounds: éki
|
15
|
+
hiragana: えき
|
16
|
+
spanish: estación de tren
|
11
17
|
- sounds: ié
|
12
18
|
hiragana: いえ
|
13
19
|
spanish: casa
|
14
20
|
- sounds: íi
|
15
21
|
hiragana: いい
|
16
22
|
spanish: bien
|
23
|
+
- sounds: i-e
|
24
|
+
hiragana: いいえ
|
25
|
+
spanish: 'no'
|
17
26
|
- sounds: ué
|
18
27
|
hiragana: うえ
|
19
28
|
spanish: arriba
|
29
|
+
- sounds: ka
|
30
|
+
hiragana: か
|
31
|
+
spanish: mosquito
|
32
|
+
- sounds: kaó
|
33
|
+
hiragana: かお
|
34
|
+
spanish: cara
|
35
|
+
- sounds: ki
|
36
|
+
hiragana: き
|
37
|
+
spanish: árbol
|
38
|
+
- sounds: kíkai
|
39
|
+
hiragana: きかい
|
40
|
+
spanish: máquina, oportunidad
|
41
|
+
- sounds: áisatsu
|
42
|
+
hiragana: あいさつ
|
43
|
+
spanish: salud
|
44
|
+
- sounds: áisatsu wo suru
|
45
|
+
hiragana: あいさつをする
|
46
|
+
spanish: saludar
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
require_relative '../hiragana'
|
3
|
+
require_relative '../dictionary'
|
4
|
+
require_relative '../debug'
|
5
|
+
require 'colorize'
|
6
|
+
|
7
|
+
module SoundGame
|
8
|
+
|
9
|
+
def self.to_hiragana(sounds)
|
10
|
+
hiraganas = Hiragana.all
|
11
|
+
|
12
|
+
hiragana_array = sounds.map { hiraganas[_1.to_sym] || '*' }
|
13
|
+
hiragana = hiragana_array.join('')
|
14
|
+
|
15
|
+
none = {'hiragana': hiragana, 'spanish': '?', 'sounds': '?'}
|
16
|
+
words = Dictionary.new.words
|
17
|
+
word = (words.select {_1["hiragana"] == hiragana})[0] || none
|
18
|
+
|
19
|
+
word
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.run
|
23
|
+
Debug.puts_line
|
24
|
+
puts "SOUNDS TO HIRAGANA".light_cyan
|
25
|
+
puts "Example: a i => あい (amor - ái)".blue
|
26
|
+
Debug.puts_line
|
27
|
+
|
28
|
+
sounds = "init"
|
29
|
+
until sounds.empty?
|
30
|
+
print "\nWrite sounds ? ".light_yellow
|
31
|
+
sounds = STDIN.gets.chomp.split
|
32
|
+
word = self.to_hiragana(sounds)
|
33
|
+
print "Hiragana => ".white
|
34
|
+
puts word["hiragana"]
|
35
|
+
print "Spanish => ".white
|
36
|
+
puts word["spanish"]
|
37
|
+
print "Pronounce => ".white
|
38
|
+
puts word["sounds"]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
require_relative 'learn-japanese/version'
|
3
|
+
require_relative 'learn-japanese/game/choose-answer-game'
|
4
|
+
require_relative 'learn-japanese/game/short-answer-game'
|
5
|
+
require_relative 'learn-japanese/game/sound-game'
|
6
|
+
|
7
|
+
module LearnJapanese
|
8
|
+
|
9
|
+
def self.show_version
|
10
|
+
puts "#{LearnJapanese::NAME} (version #{LearnJapanese::VERSION})"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.show_help
|
14
|
+
puts "Usage: learn-japanese --help"
|
15
|
+
exit 0
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.choose_answer(level)
|
19
|
+
show_help unless level > 0
|
20
|
+
ChooseAnswerGame.show_help(level)
|
21
|
+
ChooseAnswerGame.new(level).run
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.short_answer(level)
|
25
|
+
show_help unless level > 0
|
26
|
+
ShortAnswerGame.show_help(level)
|
27
|
+
ShortAnswerGame.new(level).run
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.sound
|
31
|
+
SoundGame.run
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learn-japanese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Vargas Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -24,31 +24,51 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description:
|
28
42
|
email: dvarrui@protonmail.com
|
29
43
|
executables:
|
30
44
|
- choose-answer-game
|
45
|
+
- learn-japanese
|
31
46
|
- short-answer-game
|
32
|
-
- sounds-to-hiragana
|
47
|
+
- sounds-to-hiragana
|
33
48
|
extensions: []
|
34
49
|
extra_rdoc_files: []
|
35
50
|
files:
|
36
51
|
- ".gitignore"
|
52
|
+
- ".ruby-version"
|
37
53
|
- Gemfile
|
38
54
|
- LICENSE
|
39
55
|
- README.md
|
40
56
|
- Rakefile
|
41
57
|
- bin/choose-answer-game
|
58
|
+
- bin/learn-japanese
|
42
59
|
- bin/short-answer-game
|
43
|
-
- bin/sounds-to-hiragana
|
60
|
+
- bin/sounds-to-hiragana
|
44
61
|
- examples/01-emoji.rb
|
45
62
|
- examples/02-emoji.rb
|
46
63
|
- learn-japanese.gemspec
|
64
|
+
- lib/learn-japanese.rb
|
65
|
+
- lib/learn-japanese/cli.rb
|
47
66
|
- lib/learn-japanese/data/words.yaml
|
48
67
|
- lib/learn-japanese/debug.rb
|
49
68
|
- lib/learn-japanese/dictionary.rb
|
50
69
|
- lib/learn-japanese/game/choose-answer-game.rb
|
51
70
|
- lib/learn-japanese/game/short-answer-game.rb
|
71
|
+
- lib/learn-japanese/game/sound-game.rb
|
52
72
|
- lib/learn-japanese/hiragana.rb
|
53
73
|
- lib/learn-japanese/version.rb
|
54
74
|
homepage: https://github.com/dvarrui/learn-japanese
|
@@ -70,8 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
90
|
- !ruby/object:Gem::Version
|
71
91
|
version: '0'
|
72
92
|
requirements: []
|
73
|
-
rubygems_version: 3.
|
93
|
+
rubygems_version: 3.1.6
|
74
94
|
signing_key:
|
75
95
|
specification_version: 4
|
76
|
-
summary: Learn Japanese (UNDER DEVELOPMENT
|
96
|
+
summary: Learn Japanese (UNDER DEVELOPMENT)
|
77
97
|
test_files: []
|
data/bin/sounds-to-hiragana.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
-
require 'learn-japanese/hiragana'
|
5
|
-
require 'learn-japanese/dictionary'
|
6
|
-
require 'colorize'
|
7
|
-
|
8
|
-
puts "[ Sounds to Hiragana ] Example: a i => あい (amor - ái)".white
|
9
|
-
|
10
|
-
def sound_to_hiragana
|
11
|
-
print " Write sounds ? ".light_yellow
|
12
|
-
sounds = gets.chomp.split
|
13
|
-
hiraganas = Hiragana.all
|
14
|
-
|
15
|
-
hiragana_array = sounds.map { hiraganas[_1.to_sym] || '*' }
|
16
|
-
hiragana = hiragana_array.join('')
|
17
|
-
|
18
|
-
words = Dictionary.new.words
|
19
|
-
word = (words.select { _1["hiragana"] == hiragana})[0] || {'spanish': '?', 'sounds': '?'}
|
20
|
-
|
21
|
-
puts " Hiragana => #{hiragana}".cyan
|
22
|
-
puts " Spanish => #{word["spanish"]}".cyan
|
23
|
-
puts " Pronounce => #{word["sounds"]}".cyan
|
24
|
-
|
25
|
-
return false if sounds.size.zero?
|
26
|
-
true
|
27
|
-
end
|
28
|
-
|
29
|
-
while sound_to_hiragana
|
30
|
-
end
|