text_alignment 0.2.1 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44795489705a4deb000fd96e0d37f67952b8cdc69231e4cf2050214d7ea9a0d2
4
- data.tar.gz: 2ff43965c31acddb04c0a193c402e0bb73632af32305ef54c17fdfe0de34eb19
3
+ metadata.gz: 3c42bc61965d0707fb1c8bd9815b363b04dc7d598e6c3bbbc7e318e8d7df37c6
4
+ data.tar.gz: a699745c6a92a5c980ca90add8d5e46128923fb774f204edb35514ed6b2df097
5
5
  SHA512:
6
- metadata.gz: 870b717d03327f92329c2ec4964abd9f8ea0916d98d3d615fe297fb8f0ab9adca636fede67bf130d72d53c567252e57c9dd5882c564b0d02b161fa9f8dcf9093
7
- data.tar.gz: 2edf38aa98e551e088bec873a3ebcd002f259f848f8079e0b4b885f0106ef5a5572216fa5e699ace546f1dbdc52dec3c6f64b525f1874c6adbab08800f46c418
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
- # ascii_foldings = mappings.select{|m| m[0].length == 1 && m[1].length > 1}
61
- # ascii_foldings.each do |f|
62
- # from = f[1]
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
- # if str2.index(f[0])
65
- # to = f[0] + (@nomatch_char1 * (f[1].length - 1))
66
- # str1.gsub!(from, to)
67
- # end
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
- # mappings.delete_if{|m| m[0].length == 1 && m[1].length > 1}
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
- # str1 = JSON.parse(File.read(ARGV[0]).strip)["text"]
197
- # denotations = JSON.parse(File.read(ARGV[0]).strip, symbolize_names:true)[:denotations]
198
- # str2 = JSON.parse(File.read(ARGV[1]).strip)["text"]
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"]]
@@ -1,3 +1,3 @@
1
1
  class TextAlignment
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
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.1
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-05-29 00:00:00.000000000 Z
11
+ date: 2019-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-dictionary