te_reo_maori 0.1.1 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +10 -2
- data/Dockerfile +2 -2
- data/Gemfile +4 -2
- data/README.md +14 -2
- data/exe/te_reo_maori +6 -1
- data/lib/te_reo_maori.rb +1 -0
- data/lib/te_reo_maori/tau.rb +14 -2
- data/lib/te_reo_maori/version.rb +1 -1
- data/lib/te_reo_maori/whakahua.rb +51 -0
- data/lib/te_reo_maori/whakamatautau_pangarau.rb +20 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33fd56f0fbea59f62ed3418fbd08300062f79157c5420213908d57b0f4b10c5b
|
4
|
+
data.tar.gz: 61891b379f7de2fc0b89c4c9a45b405053e2f859ee77e7a5afd49d1c1ed3a6f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 462f7843737bdd38df06ea4d46355d41bc3688f85d8d016aac68e5dc722c1055711f5ca8c028ea6bc24b2a27baf4e6688a3cba4f3c3737a6605b60af5a48b0f9
|
7
|
+
data.tar.gz: fab3e451336138f49b03697f412d3fdb61b62687d7765f6a510aa7efdaf4564fd31791167b3ff5ba8e5a0f0ea466bdb3050e7605f072a609f11b1f541c7166ed
|
data/ChangeLog
CHANGED
@@ -1,2 +1,10 @@
|
|
1
|
-
*
|
2
|
-
|
1
|
+
* 0.1.6 - Allow input of macrons
|
2
|
+
- Fixed math test
|
3
|
+
- Use Ruby 2.7 in docker
|
4
|
+
* 0.1.5 - Added simple addition math test
|
5
|
+
* 0.1.4 - Pronounce integers on inspection for better terminal experience
|
6
|
+
- Handle up to 999 and accent marks
|
7
|
+
* 0.1.3 Bug fix. 'Whakahua' did not handle 'iwa' and numbers like toru tekau
|
8
|
+
* 0.1.2 whakahua method to pronounce numbers
|
9
|
+
* 0.1.1 Has docker image. Handle up to 99
|
10
|
+
* 0.1.0 Handles numbers 1-19
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,12 @@ Tool to aid one to learn Maori and enable one to program in Maori.
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
+
Execute interactive terminal in docker
|
8
|
+
|
9
|
+
`docker run --rm -it registry.gitlab.com/samuel-garratt/te_reo_maori`
|
10
|
+
|
11
|
+
### As a ruby gem
|
12
|
+
|
7
13
|
Add this line to your application's Gemfile:
|
8
14
|
|
9
15
|
```ruby
|
@@ -25,8 +31,14 @@ Count in maori
|
|
25
31
|
```ruby
|
26
32
|
tahi + rua
|
27
33
|
# Will give a result of 3
|
34
|
+
3.whakahua
|
35
|
+
# Will return 'toru'
|
36
|
+
whakahua(tahi + tahi)
|
37
|
+
# Will return 'rua'
|
28
38
|
```
|
29
39
|
|
40
|
+
Execute in interactive terminal. After installing type `te_reo_maori` on command prompt to open it.
|
41
|
+
|
30
42
|
## Development
|
31
43
|
|
32
44
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -35,7 +47,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
35
47
|
|
36
48
|
## Contributing
|
37
49
|
|
38
|
-
Bug reports and pull requests are welcome on GitLab at https://
|
50
|
+
Bug reports and pull requests are welcome on GitLab at https://gitlab.com/samuel-garratt/te_reo_maori. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/samuel-garratt/te_reo_maori/blob/master/CODE_OF_CONDUCT.md).
|
39
51
|
|
40
52
|
|
41
53
|
## License
|
@@ -44,4 +56,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
44
56
|
|
45
57
|
## Code of Conduct
|
46
58
|
|
47
|
-
Everyone interacting in the TeReoMaori project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://
|
59
|
+
Everyone interacting in the TeReoMaori project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/samuel-garratt/te_reo_maori/blob/master/CODE_OF_CONDUCT.md).
|
data/exe/te_reo_maori
CHANGED
@@ -10,14 +10,19 @@ def putanga
|
|
10
10
|
end
|
11
11
|
|
12
12
|
extend Tau # Make numbers available
|
13
|
+
extend WhakamatautauPangarau
|
13
14
|
|
14
15
|
puts 'Nau mai haere mai. Welcome to this application for learning and interacting with Maori.'
|
15
16
|
puts 'Type "putanga" to exit'
|
17
|
+
puts 'Type "pangarau" for maths test'
|
16
18
|
puts 'Try and perform +, -, * (times), / (divide) with Maori'
|
17
19
|
puts 'The numbers are: '
|
18
20
|
Tau.rarangi.each do |tau, whakamaoritanga|
|
19
21
|
puts "#{tau}: #{whakamaoritanga}"
|
20
22
|
end
|
21
|
-
puts '
|
23
|
+
puts 'If you type a number and press you will see Maori equivalent. Numbers > 10 must be wrapped in (). Greatest supported is 999'
|
24
|
+
puts 'Example of bigger numbers. 12: "tekau ma rua". Add 23 + 33: "(rua tekau ma toru) + (toru tekau ma toru)"'
|
25
|
+
puts 'See integer form by calling "tau", e.g., "((rua tekau ma toru) + (toru tekau ma toru)).tau" '
|
26
|
+
puts 'If you have any ideas on how this can be improved add issue to https://gitlab.com/samuel-garratt/te_reo_maori/-/issues'
|
22
27
|
|
23
28
|
IRB.start(__FILE__)
|
data/lib/te_reo_maori.rb
CHANGED
data/lib/te_reo_maori/tau.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'whakahua'
|
4
|
+
|
3
5
|
# Number in Maori
|
4
6
|
module Tau
|
7
|
+
def whakahua(tau)
|
8
|
+
raise "Class '#{tau.class}' not implmemented" unless tau.is_a? Integer
|
9
|
+
|
10
|
+
tau.whakahua
|
11
|
+
end
|
12
|
+
|
5
13
|
# List numbers
|
6
14
|
def self.rarangi
|
7
15
|
{
|
8
|
-
|
9
|
-
|
16
|
+
1 => 'tahi', 2 => 'rua', 3 => 'toru', 4 => 'whā', 5 => 'rima', 6 => 'ono', 7 => 'waru',
|
17
|
+
8 => 'iwa', 9 => 'iwa', 10 => 'tekau'
|
10
18
|
}
|
11
19
|
end
|
12
20
|
|
@@ -36,6 +44,8 @@ module Tau
|
|
36
44
|
digit(4, second_digit)
|
37
45
|
end
|
38
46
|
|
47
|
+
alias whā wha
|
48
|
+
|
39
49
|
# 5
|
40
50
|
def rima(second_digit = nil)
|
41
51
|
digit(5, second_digit)
|
@@ -67,4 +77,6 @@ module Tau
|
|
67
77
|
def ma(extra_digit)
|
68
78
|
extra_digit
|
69
79
|
end
|
80
|
+
|
81
|
+
alias mā ma
|
70
82
|
end
|
data/lib/te_reo_maori/version.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Extension to Integer for Maori
|
4
|
+
class Integer
|
5
|
+
def inspect
|
6
|
+
whakahua
|
7
|
+
end
|
8
|
+
|
9
|
+
# Numeric form of integer
|
10
|
+
def tau
|
11
|
+
to_s
|
12
|
+
end
|
13
|
+
|
14
|
+
# @param [Integer] upper_part Integer of number of 100s
|
15
|
+
# @param [String] lower_part Already translated part less than 100
|
16
|
+
def add_parts(upper_part, lower_part)
|
17
|
+
if upper_part == 0
|
18
|
+
lower_part
|
19
|
+
elsif upper_part == 1
|
20
|
+
"kotahi rau #{lower_part}"
|
21
|
+
else
|
22
|
+
"#{upper_part.whakahua} rau #{lower_part}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Pronounce number
|
27
|
+
def whakahua
|
28
|
+
raise NotImplementedError, "Amount of #{self} implemented yet" if self > 999 || self < 1
|
29
|
+
return 'kotahi rau' if self == 100
|
30
|
+
|
31
|
+
lower_part = self % 100
|
32
|
+
upper_part = self / 100
|
33
|
+
|
34
|
+
last_digit = lower_part % 10
|
35
|
+
last_digit_word = Tau.rarangi[last_digit]
|
36
|
+
|
37
|
+
first_digit = (lower_part / 10)
|
38
|
+
if first_digit.positive?
|
39
|
+
if last_digit.zero?
|
40
|
+
return add_parts(upper_part, 'tekau') if first_digit == 1
|
41
|
+
|
42
|
+
return add_parts upper_part, "#{Tau.rarangi[first_digit]} tekau"
|
43
|
+
end
|
44
|
+
|
45
|
+
return add_parts upper_part, "tekau mā #{last_digit_word}" if first_digit == 1
|
46
|
+
|
47
|
+
return add_parts upper_part, "#{Tau.rarangi[first_digit]} tekau mā #{last_digit_word}"
|
48
|
+
end
|
49
|
+
add_parts upper_part, last_digit_word
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Math test
|
4
|
+
module WhakamatautauPangarau
|
5
|
+
# Mathematics. Start a maths test
|
6
|
+
def pangarau
|
7
|
+
puts 'Nau mai. Please type the answer in Teo Reo Maori (e.g "tahi" for 1) when prompted'
|
8
|
+
tau1 = rand(100).to_i
|
9
|
+
tau2 = rand(100).to_i
|
10
|
+
whakautu_tika = tau1 + tau2
|
11
|
+
puts "#{tau1.inspect} + #{tau2.inspect}?"
|
12
|
+
whakautu = eval(gets).to_i
|
13
|
+
if whakautu == whakautu_tika
|
14
|
+
puts 'Ka pai. Correct!'
|
15
|
+
else
|
16
|
+
puts "Incorrect. You put '#{whakautu.inspect} (#{whakautu})'.
|
17
|
+
Correct answer is '#{whakautu_tika.inspect} (#{whakautu_tika})'"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: te_reo_maori
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Garratt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Tool to aid one to learn Maori and enable one to program in Maori.
|
14
14
|
email:
|
@@ -34,6 +34,8 @@ files:
|
|
34
34
|
- lib/te_reo_maori.rb
|
35
35
|
- lib/te_reo_maori/tau.rb
|
36
36
|
- lib/te_reo_maori/version.rb
|
37
|
+
- lib/te_reo_maori/whakahua.rb
|
38
|
+
- lib/te_reo_maori/whakamatautau_pangarau.rb
|
37
39
|
- te_reo_maori.gemspec
|
38
40
|
homepage: https://gitlab.com/samuel-garratt/te_reo_maori
|
39
41
|
licenses:
|