text_alignment 0.7 → 0.7.1
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 +15 -13
- 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: '088ea92f4ca68c574cbd04bbf932aa70014b58cbbad82028b7161e0af35cdb4c'
|
4
|
+
data.tar.gz: 455e6b53a846e7ebf0a90e724b93b78b61025ccb2d02c1e167f1969946b292e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02cdb75cc9b95415c0e86d78bc0278ab8a0cf5a7afa1870ba5c10f0137e59ea782b92e8130ea2f9b3e16fd43b08c8c72da0d2b2ecf4546cb6a46a72ad62957ef
|
7
|
+
data.tar.gz: 1216190e0b3880acedc6b735b70a3611469f4fcb4506f059271acbef8d84ffdee793234029c8e5f9e9d1f10cdf088ed44a8c54c93986b19757036aceaf938247
|
@@ -120,6 +120,8 @@ class TextAlignment::TextAlignment
|
|
120
120
|
else
|
121
121
|
[{source:{begin:last_block[:source][:end], end:str1.length}, alignment: :empty}]
|
122
122
|
end
|
123
|
+
else
|
124
|
+
[]
|
123
125
|
end
|
124
126
|
end
|
125
127
|
|
@@ -168,17 +170,15 @@ class TextAlignment::TextAlignment
|
|
168
170
|
|
169
171
|
if tblocks.empty?
|
170
172
|
if b1 == 0 && e1 == str1.length
|
171
|
-
|
173
|
+
block1 = str1[b1 ... e1]
|
174
|
+
block2 = str2[b2 ... e2]
|
175
|
+
|
176
|
+
## character-based alignment
|
177
|
+
alignment = TextAlignment::MixedAlignment.new(block1.downcase, block2.downcase)
|
178
|
+
if alignment.sdiff.nil?
|
172
179
|
[{source:{begin:b1, end:e1}, target:{begin:b2, end:e2}, alignment: :empty}]
|
173
180
|
else
|
174
|
-
|
175
|
-
block2 = str2[b2 ... e2]
|
176
|
-
|
177
|
-
## character-based alignment
|
178
|
-
alignment = TextAlignment::MixedAlignment.new(block1.downcase, block2.downcase)
|
179
|
-
[{source:{begin:b1, end:e1}, target:{begin:b2, end:e2}, alignment:alignment, similarity: alignment.similarity}]
|
180
|
-
# alignment = :alignment
|
181
|
-
# [{source:{begin:b1, end:e1}, target:{begin:b2, end:e2}, alignment: :alignment}]
|
181
|
+
[{source:{begin:b1, end:e1}, target:{begin:b2, end:e2}, alignment: alignment, similarity: alignment.similarity}]
|
182
182
|
end
|
183
183
|
else
|
184
184
|
block1 = str1[b1 ... e1]
|
@@ -186,9 +186,11 @@ class TextAlignment::TextAlignment
|
|
186
186
|
|
187
187
|
## character-based alignment
|
188
188
|
alignment = TextAlignment::MixedAlignment.new(block1.downcase, block2.downcase)
|
189
|
-
|
190
|
-
|
191
|
-
|
189
|
+
if alignment.sdiff.nil?
|
190
|
+
[{source:{begin:b1, end:e1}, target:{begin:b2, end:e2}, alignment: :empty}]
|
191
|
+
else
|
192
|
+
[{source:{begin:b1, end:e1}, target:{begin:b2, end:e2}, alignment: alignment, similarity: alignment.similarity}]
|
193
|
+
end
|
192
194
|
end
|
193
195
|
else
|
194
196
|
last_tblock = nil
|
@@ -199,7 +201,7 @@ class TextAlignment::TextAlignment
|
|
199
201
|
sum += if te1 == tb1
|
200
202
|
[tblock]
|
201
203
|
else
|
202
|
-
tb2 = last_tblock ?
|
204
|
+
tb2 = last_tblock ? last_tblock[:target][:end] : b2
|
203
205
|
te2 = tblock[:target][:begin]
|
204
206
|
|
205
207
|
if b2 == e2
|
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:
|
4
|
+
version: 0.7.1
|
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: 2020-10-
|
11
|
+
date: 2020-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-dictionary
|