text_alignment 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/text_alignment/text_alignment.rb +18 -19
- data/lib/text_alignment/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c42bc61965d0707fb1c8bd9815b363b04dc7d598e6c3bbbc7e318e8d7df37c6
|
4
|
+
data.tar.gz: a699745c6a92a5c980ca90add8d5e46128923fb774f204edb35514ed6b2df097
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f03b5fa91cb4056844c8a02a48321fedc8a8e7f5a617f720b325c5c8bc40f43bc1e0ffebd25bce82777e1efce2421f0926a4a37dbcfe244b3792a7a19fe103f
|
7
|
+
data.tar.gz: cc5cd6a308fd99188b753ff28eb885e46aaf7b0dd51fa83046e2a12d9b9a4723eebdfa90be21ada755f7819362dc1974ff6f288b0799184880f19d235ae38ec6
|
@@ -57,22 +57,21 @@ class TextAlignment::TextAlignment
|
|
57
57
|
mappings.delete_if{|m| m[0].length == 1 && m[1].length == 1}
|
58
58
|
|
59
59
|
# ASCII foldings
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
ascii_foldings = mappings.select{|m| m[0].length == 1 && m[1].length > 1}
|
61
|
+
ascii_foldings.each do |f|
|
62
|
+
from = f[1]
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
# if str1.index(f[0])
|
70
|
-
# to = f[0] + (@nomatch_char2 * (f[1].length - 1))
|
71
|
-
# str2.gsub!(from, to)
|
72
|
-
# end
|
73
|
-
# end
|
64
|
+
if str2.index(f[0])
|
65
|
+
to = f[0] + (@nomatch_char1 * (f[1].length - 1))
|
66
|
+
str1.gsub!(from, to)
|
67
|
+
end
|
74
68
|
|
75
|
-
|
69
|
+
if str1.index(f[0])
|
70
|
+
to = f[0] + (@nomatch_char2 * (f[1].length - 1))
|
71
|
+
str2.gsub!(from, to)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
mappings.delete_if{|m| m[0].length == 1 && m[1].length > 1}
|
76
75
|
|
77
76
|
_compute_mixed_alignment(str1, str2, mappings)
|
78
77
|
end
|
@@ -193,11 +192,11 @@ if __FILE__ == $0
|
|
193
192
|
# anns2 = JSON.parse File.read(ARGV[1]), :symbolize_names => true
|
194
193
|
|
195
194
|
if ARGV.length == 2
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
str1 = File.read(ARGV[0])
|
200
|
-
str2 = File.read(ARGV[1])
|
195
|
+
str1 = JSON.parse(File.read(ARGV[0]).strip)["text"]
|
196
|
+
denotations = JSON.parse(File.read(ARGV[0]).strip, symbolize_names:true)[:denotations]
|
197
|
+
str2 = JSON.parse(File.read(ARGV[1]).strip)["text"]
|
198
|
+
# str1 = File.read(ARGV[0])
|
199
|
+
# str2 = File.read(ARGV[1])
|
201
200
|
end
|
202
201
|
|
203
202
|
# dictionary = [["β", "beta"]]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: text_alignment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jin-Dong Kim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-dictionary
|