text_alignment 0.3.14 → 0.3.15
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 +4 -4
- data/bin/align_annotations +10 -1
- data/lib/text_alignment/anchor_finder.rb +1 -1
- data/lib/text_alignment/text_alignment.rb +4 -2
- 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: 8252929e7b74251db493ad991332d0da8a92f35441e2a442d05b6fb29139d657
|
4
|
+
data.tar.gz: c9e41127fb231e4db2843696c1029b35711449c5bf5104158da301d03b817131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fc8da7324d71cf25edbec9765ab512928323079472736ea4e294abb12dfafc87f55d71cb49c371470811775bd489d3c91cce4a787b99faa305f2f326dc80c77
|
7
|
+
data.tar.gz: f694c99216b59dd693a6acdfffc727fe74b5c189b4b9583b31fb7e6394319a3176de76237a142dac3770bcd1fbbc467d5d1e97a7225ed993a21246a66de8b2ec
|
data/bin/align_annotations
CHANGED
@@ -129,8 +129,9 @@ else
|
|
129
129
|
puts
|
130
130
|
puts "=====END"
|
131
131
|
|
132
|
-
|
132
|
+
pp alignment
|
133
133
|
|
134
|
+
exit
|
134
135
|
# alignment.block_alignments.each do |a|
|
135
136
|
# if a[:alignment].nil? || a[:alignment] == :empty
|
136
137
|
# # p [a[:source], a[:target]]
|
@@ -153,8 +154,16 @@ else
|
|
153
154
|
p d unless d[:span][:begin] && d[:span][:end] && d[:span][:begin] < d[:span][:end] && d[:span][:begin] >= 0 && d[:span][:end] < source_text.length
|
154
155
|
end
|
155
156
|
puts "====="
|
157
|
+
puts
|
156
158
|
|
157
159
|
denotations = alignment.transform_hdenotations(source_annotations[:denotations])
|
160
|
+
puts "[Invalid transformation]"
|
161
|
+
denotations.each do |d|
|
162
|
+
p d unless d[:span][:begin] && d[:span][:end] && d[:span][:begin] < d[:span][:end] && d[:span][:begin] >= 0 && d[:span][:end] < target_text.length
|
163
|
+
end
|
164
|
+
puts "====="
|
165
|
+
puts
|
166
|
+
|
158
167
|
lost_annotations += alignment.lost_annotations if alignment.lost_annotations
|
159
168
|
|
160
169
|
source_annotations.merge({text:target_text, denotations:denotations})
|
@@ -4,7 +4,7 @@ require 'string-similarity'
|
|
4
4
|
module TextAlignment; end unless defined? TextAlignment
|
5
5
|
|
6
6
|
TextAlignment::SIZE_NGRAM = 10 unless defined? TextAlignment::SIZE_NGRAM
|
7
|
-
TextAlignment::SIZE_WINDOW =
|
7
|
+
TextAlignment::SIZE_WINDOW = 30 unless defined? TextAlignment::SIZE_WINDOW
|
8
8
|
TextAlignment::TEXT_SIMILARITY_TRESHOLD = 0.8 unless defined? TextAlignment::TEXT_SIMILARITY_TRESHOLD
|
9
9
|
|
10
10
|
class TextAlignment::AnchorFinder
|
@@ -170,7 +170,8 @@ class TextAlignment::TextAlignment
|
|
170
170
|
if begin_position == block_alignment[:source][:begin]
|
171
171
|
block_alignment[:target][:begin]
|
172
172
|
else
|
173
|
-
raise "lost annotation"
|
173
|
+
# raise "lost annotation"
|
174
|
+
nil
|
174
175
|
end
|
175
176
|
else
|
176
177
|
block_alignment[:alignment].transform_begin_position(begin_position - block_alignment[:source][:begin]) + block_alignment[:target][:begin]
|
@@ -187,7 +188,8 @@ class TextAlignment::TextAlignment
|
|
187
188
|
if end_position == block_alignment[:source][:end]
|
188
189
|
block_alignment[:target][:end]
|
189
190
|
else
|
190
|
-
raise "lost annotation"
|
191
|
+
# raise "lost annotation"
|
192
|
+
nil
|
191
193
|
end
|
192
194
|
else
|
193
195
|
block_alignment[:alignment].transform_end_position(end_position - block_alignment[:source][:begin]) + block_alignment[:target][:begin]
|
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.3.
|
4
|
+
version: 0.3.15
|
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-09-
|
11
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-dictionary
|