learn-japanese 0.4.1 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/README.md +20 -13
- data/bin/learn-japanese +6 -0
- data/bin/sounds-to-hiragana +2 -26
- 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/hiragana.rb +3 -3
- data/lib/learn-japanese/version.rb +3 -2
- data/lib/learn-japanese.rb +33 -0
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9914d80e21c8c34c39ed26df234b08cd46b4c415cc1abf350cd765b7a356213a
|
4
|
+
data.tar.gz: 31e75a97b121964b1ef3828ea751c82f9897594cba31763f8a9a35b0b96674b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 568c67a6f8eb933bad67fc61c47fc0822c6cab94005df74f99bb0ee9415be7556c48faa5060f3dfc970b57bf9cdcaf5ddc16fa439a9baccb697bf701a8bc8059
|
7
|
+
data.tar.gz: 6f9d1f6b74ad511b674454b9f0638b86cab521bbcb24936d69075205041ec30050fab11e291260eb44f2927be2d42020bdf2fd0e2fa0d1ab83356c917d6748a9
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.0
|
data/README.md
CHANGED
@@ -1,25 +1,32 @@
|
|
1
1
|
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/learn-japanese.svg)](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.
|
18
|
-
* `sounds-to-hiragana`, pasar sonidos a Hiragana.
|
12
|
+
## Installation
|
19
13
|
|
20
|
-
|
14
|
+
1. Install Ruby on your system.
|
15
|
+
2. Open a terminal and run `sudo gem install learn-japanese`, to install the Ruby gem.
|
21
16
|
|
22
|
-
|
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
|
23
30
|
|
24
31
|
## Hiragana
|
25
32
|
|
data/bin/learn-japanese
ADDED
data/bin/sounds-to-hiragana
CHANGED
@@ -1,30 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
-
require 'learn-japanese/
|
5
|
-
require 'learn-japanese/dictionary'
|
6
|
-
require 'colorize'
|
4
|
+
require 'learn-japanese/game/sound-game'
|
7
5
|
|
8
|
-
|
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
|
6
|
+
SoundGame.run
|
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
|
@@ -24,7 +24,7 @@ class Hiragana
|
|
24
24
|
|
25
25
|
def self.group3
|
26
26
|
{ sa: "\u{3055}",
|
27
|
-
|
27
|
+
shi: "\u{3057}",
|
28
28
|
su: "\u{3059}",
|
29
29
|
se: "\u{305B}",
|
30
30
|
so: "\u{305D}"
|
@@ -33,8 +33,8 @@ class Hiragana
|
|
33
33
|
|
34
34
|
def self.group4
|
35
35
|
{ ta: "\u{305F}",
|
36
|
-
|
37
|
-
|
36
|
+
chi: "\u{3061}",
|
37
|
+
tsu: "\u{3064}",
|
38
38
|
te: "\u{3066}",
|
39
39
|
to: "\u{3068}"
|
40
40
|
}
|
@@ -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.1
|
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
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
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
|
@@ -73,5 +93,5 @@ requirements: []
|
|
73
93
|
rubygems_version: 3.3.3
|
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: []
|