text_alignment 0.7 → 0.7.1

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: 40796a906cbc366312741d3b410aaee15d28b778980674bb79d19ea1b6364d02
4
- data.tar.gz: eb0121440bc005232b3d35eb1867b46004eb14c894b630f2ef49d311c4d99a26
3
+ metadata.gz: '088ea92f4ca68c574cbd04bbf932aa70014b58cbbad82028b7161e0af35cdb4c'
4
+ data.tar.gz: 455e6b53a846e7ebf0a90e724b93b78b61025ccb2d02c1e167f1969946b292e2
5
5
  SHA512:
6
- metadata.gz: e29037021763c9d4f581b278b72d319d364431e8abad48b45f21d68df102928eec993bbba582383a8a01b6ba7855f3542d2cc620ffa055a90aea08c2f5371117
7
- data.tar.gz: 63c0e5b712b89012082197d3c4400cd705283e6d908f40003a399cb2efdc2b3aa4f6e445eb90e1ab4d7d39a9d14421881f945e0483c14ec52c1af7176ca07e81
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
- if str2.length > 2000
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
- block1 = str1[b1 ... e1]
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
- [{source:{begin:b1, end:e1}, target:{begin:b2, end:e2}, alignment:alignment, similarity: alignment.similarity}]
190
- # alignmnet = :alignment
191
- # [{source:{begin:b1, end:e1}, target:{begin:b2, end:e2}, alignment: :alignment}]
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 ? tlast_block[:target][:end] : b2
204
+ tb2 = last_tblock ? last_tblock[:target][:end] : b2
203
205
  te2 = tblock[:target][:begin]
204
206
 
205
207
  if b2 == e2
@@ -1,3 +1,3 @@
1
1
  class TextAlignment
2
- VERSION = '0.7'
2
+ VERSION = '0.7.1'
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.7'
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 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-dictionary