text_alignment 0.7.2 → 0.7.3
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0788bdb6d161499f5a5258757b9f61faee96b60246b422b57b17ba953b4a2c87'
|
|
4
|
+
data.tar.gz: 4564fd15e1e1d673932438206989dc706aa67f2467698f16946e2635c562ec90
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c93882cc28e8bfdbdeed325b282b63fd3f3644d1739ed979ef92a7d8a133e26f4a8ffd0bda22da0fc2e0a31c77c6d49ce89f8f0fae802c9ae2041a7db60a2a4e
|
|
7
|
+
data.tar.gz: 238ed44ac0c0a178a64743846550639c626d3a300a79f05fedb016e71a890f11025b52d260ce2f46f00d68b1c4b9c13c48a8be8712f737bb2b57b0274b174b8b
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module TextAlignment; end unless defined? TextAlignment
|
|
2
2
|
|
|
3
3
|
TextAlignment::SIZE_NGRAM = 8 unless defined? TextAlignment::SIZE_NGRAM
|
|
4
|
-
TextAlignment::SIZE_WINDOW =
|
|
4
|
+
TextAlignment::SIZE_WINDOW = 30 unless defined? TextAlignment::SIZE_WINDOW
|
|
5
5
|
TextAlignment::BUFFER_RATE = 0.1 unless defined? TextAlignment::BUFFER_RATE
|
|
6
6
|
TextAlignment::BUFFER_MIN = 20 unless defined? TextAlignment::BUFFER_MIN
|
|
7
7
|
TextAlignment::TEXT_SIMILARITY_THRESHOLD = 0.9 unless defined? TextAlignment::TEXT_SIMILARITY_THRESHOLD
|
|
@@ -63,6 +63,7 @@ TextAlignment::MAPPINGS = [
|
|
|
63
63
|
[" ", " "], #U+200A (hair space)
|
|
64
64
|
[" ", " "], #U+00A0 (no-break space)
|
|
65
65
|
[" ", " "], #U+3000 (ideographic space)
|
|
66
|
+
["‑", "-"], #U+2211 (Non-Breaking Hyphen)
|
|
66
67
|
["−", "-"], #U+2212 (minus sign)
|
|
67
68
|
["–", "-"], #U+2013 (en dash)
|
|
68
69
|
["′", "'"], #U+2032 (prime)
|
|
@@ -170,7 +170,7 @@ class TextAlignment::TextAlignment
|
|
|
170
170
|
|
|
171
171
|
if tblocks.empty?
|
|
172
172
|
if b1 == 0 && e1 == str1.length
|
|
173
|
-
if (e1 >
|
|
173
|
+
if (e1 > 2000) || (e2 > 2000)
|
|
174
174
|
[{source:{begin:b1, end:e1}, target:{begin:b2, end:e2}, alignment: :empty}]
|
|
175
175
|
else
|
|
176
176
|
block1 = str1[b1 ... e1]
|