braille_ueb 0.0.1 → 0.0.2
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.
- data/Rakefile +2 -0
- data/lib/braille_ueb/constants.rb +51 -50
- data/lib/braille_ueb/version.rb +3 -0
- data/spec/braille_ueb_spec.rb +23 -22
- metadata +4 -2
data/Rakefile
ADDED
@@ -1,68 +1,69 @@
|
|
1
|
+
#encoding: UTF-8
|
1
2
|
module BrailleUEB
|
2
3
|
|
3
4
|
ALPHA = {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
5
|
+
'a' => '⠁',
|
6
|
+
'b' => '⠃',
|
7
|
+
'c' => '⠉',
|
8
|
+
'd' => '⠙',
|
9
|
+
'e' => '⠑',
|
10
|
+
'f' => '⠋',
|
11
|
+
'g' => '⠛',
|
12
|
+
'h' => '⠓',
|
13
|
+
'i' => '⠊',
|
14
|
+
'j' => '⠚',
|
15
|
+
'k' => '⠅',
|
16
|
+
'l' => '⠇',
|
17
|
+
'm' => '⠍',
|
18
|
+
'n' => '⠝',
|
19
|
+
'o' => '⠕',
|
20
|
+
'p' => '⠏',
|
21
|
+
'q' => '⠟',
|
22
|
+
'r' => '⠗',
|
23
|
+
's' => '⠎',
|
24
|
+
't' => '⠞',
|
25
|
+
'u' => '⠥',
|
26
|
+
'v' => '⠧',
|
27
|
+
'w' => '⠺',
|
28
|
+
'x' => '⠭',
|
29
|
+
'y' => '⠽',
|
30
|
+
'z' => '⠵'
|
30
31
|
}
|
31
32
|
|
32
33
|
NUMBER = {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
34
|
+
'1' => '⠁',
|
35
|
+
'2' => '⠃',
|
36
|
+
'3' => '⠉',
|
37
|
+
'4' => '⠙',
|
38
|
+
'5' => '⠑',
|
39
|
+
'6' => '⠋',
|
40
|
+
'7' => '⠛',
|
41
|
+
'8' => '⠓',
|
42
|
+
'9' => '⠊',
|
43
|
+
'0' => '⠚'
|
43
44
|
}
|
44
45
|
|
45
46
|
SPECIAL = {
|
46
|
-
:capital
|
47
|
-
:number
|
47
|
+
:capital => '⠠',
|
48
|
+
:number => '⠼'
|
48
49
|
}
|
49
50
|
|
50
51
|
PUNCTUATION = {
|
51
|
-
|
52
|
-
|
52
|
+
'.' => '⠲',
|
53
|
+
',' => '⠂'
|
53
54
|
}
|
54
55
|
|
55
56
|
CONTRACTIONS = {
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
57
|
+
'like' => '⠇',
|
58
|
+
'but' => '⠃',
|
59
|
+
'you' => '⠽',
|
60
|
+
'will' => '⠺',
|
61
|
+
'just' => '⠚',
|
62
|
+
'do' => '⠙',
|
63
|
+
'that' => '⠞',
|
64
|
+
'so' => '⠎',
|
65
|
+
'can' => '⠉',
|
66
|
+
'go' => '⠛'
|
66
67
|
}
|
67
68
|
|
68
69
|
end
|
data/spec/braille_ueb_spec.rb
CHANGED
@@ -1,45 +1,46 @@
|
|
1
|
+
#encoding: UTF-8
|
1
2
|
require_relative '../lib/braille_ueb'
|
2
3
|
|
3
4
|
describe BrailleUEB do
|
4
5
|
|
5
|
-
it
|
6
|
-
verify
|
7
|
-
verify
|
8
|
-
verify
|
6
|
+
it 'should convert the alphabet' do
|
7
|
+
verify 'a', '⠁'
|
8
|
+
verify 'b', '⠃'
|
9
|
+
verify 'c', '⠉'
|
9
10
|
end
|
10
11
|
|
11
|
-
it
|
12
|
-
verify
|
12
|
+
it 'should convert capital letters' do
|
13
|
+
verify 'Z', '⠠⠵'
|
13
14
|
end
|
14
15
|
|
15
|
-
it
|
16
|
-
verify
|
17
|
-
verify
|
18
|
-
verify
|
16
|
+
it 'should convert single numbers' do
|
17
|
+
verify '1', '⠼⠁'
|
18
|
+
verify '2', '⠼⠃'
|
19
|
+
verify '3', '⠼⠉'
|
19
20
|
end
|
20
21
|
|
21
|
-
it
|
22
|
-
verify
|
22
|
+
it 'should only put the number prefix for the the first number' do
|
23
|
+
verify '12', '⠼⠁⠃'
|
23
24
|
end
|
24
25
|
|
25
|
-
it
|
26
|
-
verify
|
26
|
+
it 'should convert a period to a full stop' do
|
27
|
+
verify 'Z.', '⠠⠵⠲'
|
27
28
|
end
|
28
29
|
|
29
|
-
it
|
30
|
-
verify
|
30
|
+
it 'should convert a comma' do
|
31
|
+
verify ',', '⠂'
|
31
32
|
end
|
32
33
|
|
33
|
-
it
|
34
|
-
verify
|
34
|
+
it 'should perform contractions' do
|
35
|
+
verify 'like', '⠇'
|
35
36
|
end
|
36
37
|
|
37
|
-
it
|
38
|
-
verify
|
38
|
+
it 'should perform contractions that end with punctuation' do
|
39
|
+
verify 'like.', '⠇⠲'
|
39
40
|
end
|
40
41
|
|
41
|
-
it
|
42
|
-
verify
|
42
|
+
it 'should captialize contractions' do
|
43
|
+
verify 'Like', '⠠⠇'
|
43
44
|
end
|
44
45
|
|
45
46
|
def verify(english, braille)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braille_ueb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-04 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A translator for Unified English Braille (UEB)
|
15
15
|
email: chris@geihsler.net
|
@@ -17,8 +17,10 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- Rakefile
|
20
21
|
- lib/braille_ueb/char.rb
|
21
22
|
- lib/braille_ueb/constants.rb
|
23
|
+
- lib/braille_ueb/version.rb
|
22
24
|
- lib/braille_ueb/word.rb
|
23
25
|
- lib/braille_ueb.rb
|
24
26
|
- spec/braille_ueb_spec.rb
|