simple_bioc 0.0.8 → 0.0.9

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
  SHA1:
3
- metadata.gz: 2db1d0eca30d1829335e2953febac31c9d9278f7
4
- data.tar.gz: 3ccb2c94824e37ffc5cf9576b15328d37f880a68
3
+ metadata.gz: 74a3d6d3513cdaa61df2b88050b9a44cf0852ed1
4
+ data.tar.gz: 8c14726b89b7d2f79ffc63b8db0ac5427d38640a
5
5
  SHA512:
6
- metadata.gz: 81deae4a51d85fc659680359ba4e3dc0d8d09b006f8c5272041a8a8773b0c59b9f4f78d851dcc408ec0cd5d12197e9cde49aa98072ccbfb11965741be78fb542
7
- data.tar.gz: c9fd968958871c146bcba7f468c04f152269daaf6b91425ee98cab129bb0a32d2445d227b4c914c88a3336feeae246106dc92f6dcefe9762482189e909aad95a
6
+ metadata.gz: 2559a63848b14f15b0a26a745ae7d1a58d677fbfd520b7f42467e76a2b69bdffda4eeedf73319c79a3d13abcbf7ad008f87899c36111dd6ae1e6591767a0e281
7
+ data.tar.gz: c25c91ce425ed2b1a4050898ae61415507c4720c9c54b660461d0ebb7535ffe1d821142cc0db9dc66d18e74c9153c3d74a7590395f4fa3c574958e06ba4332f6
@@ -45,7 +45,7 @@ module BioCMerger
45
45
  if p_d.sentences.size == p_s.sentences.size
46
46
  p_d.sentences.each_with_index do |s_d, index|
47
47
  s_s = p_s.sentences[index]
48
- copy_infons(s_d, s_s, warnings)
48
+ copy_infons(s_d, s_s)
49
49
  copy_text(s_d, s_s)
50
50
  copy_relations(doc_d, s_d, s_s, id_map)
51
51
  copy_annotations(doc_d, s_d, s_s, id_map)
@@ -132,8 +132,8 @@ module BioCMerger
132
132
  new_r.id = choose_id(doc, relation.id, id_map)
133
133
  relation.nodes.each do |n|
134
134
  node = SimpleBioC::Node.new(new_r)
135
- node.refid = relation.refid
136
- node.role = relation.role
135
+ node.refid = n.refid
136
+ node.role = n.role
137
137
  new_r.nodes << node
138
138
  end
139
139
  copy_infons(new_r, relation)
@@ -157,7 +157,7 @@ module BioCMerger
157
157
  end
158
158
 
159
159
  def choose_id(doc, id, id_map)
160
- new_id = id
160
+ new_id = id || "id"
161
161
  node = doc.find_node(new_id)
162
162
 
163
163
  until node.nil? do
@@ -193,6 +193,7 @@ module BioCMerger
193
193
 
194
194
  def find_all_locations(obj, text)
195
195
  positions = []
196
+ return positions if obj.nil? || obj.text.nil?
196
197
  pos = obj.text.index(text)
197
198
  until pos.nil?
198
199
  positions << (pos + obj.offset)
@@ -1,3 +1,3 @@
1
1
  module SimpleBioC
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -41,15 +41,13 @@ describe "File Check" do
41
41
  col5 = SimpleBioC.from_xml("./xml/merge/output.xml")
42
42
  end
43
43
 
44
- it "should merge documents successfully with abbr" do
45
- col1 = SimpleBioC.from_xml("./xml/merge/9864355.xml")
46
- col2 = SimpleBioC.from_xml("./xml/abbr.xml")
47
-
48
- SimpleBioC.merge(col1, col2)
49
- output = SimpleBioC.to_xml(col1)
50
- File.write("./xml/merge/output.xml", output)
51
- puts "merge12"
52
- col5 = SimpleBioC.from_xml("./xml/merge/output.xml")
53
- end
54
-
44
+ it "should load XML files successfully" do
45
+ Dir["./xml/*.xml"].each do |file_path|
46
+ puts "self-merge #{file_path}"
47
+ collection1 = SimpleBioC.from_xml(file_path)
48
+ collection2 = SimpleBioC.from_xml(file_path)
49
+ SimpleBioC.merge(collection1, collection2)
50
+ output = SimpleBioC.to_xml(collection1)
51
+ end
52
+ end
55
53
  end