simple_bioc 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +73 -3
- data/Rakefile +5 -0
- data/html/BioCReader.html +657 -0
- data/html/BioCWriter.html +556 -0
- data/html/README_md.html +231 -0
- data/html/SimpleBioC.html +255 -0
- data/html/SimpleBioC/Annotation.html +279 -0
- data/html/SimpleBioC/Collection.html +316 -0
- data/html/SimpleBioC/Document.html +426 -0
- data/html/SimpleBioC/Location.html +288 -0
- data/html/SimpleBioC/Node.html +334 -0
- data/html/SimpleBioC/NodeBase.html +281 -0
- data/html/SimpleBioC/Passage.html +418 -0
- data/html/SimpleBioC/Relation.html +301 -0
- data/html/SimpleBioC/Sentence.html +399 -0
- data/html/created.rid +15 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +212 -0
- data/html/js/darkfish.js +155 -0
- data/html/js/jquery.js +18 -0
- data/html/js/navigation.js +142 -0
- data/html/js/search.js +94 -0
- data/html/js/search_index.js +1 -0
- data/html/js/searcher.js +228 -0
- data/html/rdoc.css +595 -0
- data/html/table_of_contents.html +199 -0
- data/lib/simple_bioc.rb +4 -0
- data/lib/simple_bioc/annotation.rb +10 -6
- data/lib/simple_bioc/bioc_reader.rb +2 -2
- data/lib/simple_bioc/collection.rb +13 -11
- data/lib/simple_bioc/document.rb +31 -22
- data/lib/simple_bioc/location.rb +13 -7
- data/lib/simple_bioc/node.rb +14 -8
- data/lib/simple_bioc/node_base.rb +13 -10
- data/lib/simple_bioc/passage.rb +26 -23
- data/lib/simple_bioc/relation.rb +13 -8
- data/lib/simple_bioc/sentence.rb +21 -15
- data/lib/simple_bioc/version.rb +2 -2
- data/samples/print_annotation.rb +18 -0
- data/samples/sample1.rb +31 -0
- data/simple_bioc.gemspec +1 -1
- metadata +52 -2
@@ -0,0 +1,199 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Table of Contents - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body class="indexpage">
|
24
|
+
<h1>Table of Contents - RDoc Documentation</h1>
|
25
|
+
|
26
|
+
<h2>Pages</h2>
|
27
|
+
<ul>
|
28
|
+
<li class="file">
|
29
|
+
<a href="README_md.html">README</a>
|
30
|
+
|
31
|
+
<img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings">
|
32
|
+
<ul class="initially-hidden">
|
33
|
+
<li><a href="README_md.html#label-SimpleBioc">SimpleBioc</a>
|
34
|
+
<li><a href="README_md.html#label-Feature%3A">Feature:</a>
|
35
|
+
<li><a href="README_md.html#label-Installation">Installation</a>
|
36
|
+
<li><a href="README_md.html#label-Usages">Usages</a>
|
37
|
+
<li><a href="README_md.html#label-Sample">Sample</a>
|
38
|
+
<li><a href="README_md.html#label-Contributing">Contributing</a>
|
39
|
+
<li><a href="README_md.html#label-LICENSE">LICENSE</a>
|
40
|
+
</ul>
|
41
|
+
</li>
|
42
|
+
|
43
|
+
</ul>
|
44
|
+
|
45
|
+
<h2 id="classes">Classes/Modules</h2>
|
46
|
+
<ul>
|
47
|
+
<li class="module">
|
48
|
+
<a href="BioCReader.html">BioCReader</a>
|
49
|
+
</li>
|
50
|
+
<li class="module">
|
51
|
+
<a href="BioCWriter.html">BioCWriter</a>
|
52
|
+
</li>
|
53
|
+
<li class="module">
|
54
|
+
<a href="SimpleBioC.html">SimpleBioC</a>
|
55
|
+
</li>
|
56
|
+
<li class="class">
|
57
|
+
<a href="SimpleBioC/Annotation.html">SimpleBioC::Annotation</a>
|
58
|
+
</li>
|
59
|
+
<li class="class">
|
60
|
+
<a href="SimpleBioC/Collection.html">SimpleBioC::Collection</a>
|
61
|
+
</li>
|
62
|
+
<li class="class">
|
63
|
+
<a href="SimpleBioC/Document.html">SimpleBioC::Document</a>
|
64
|
+
</li>
|
65
|
+
<li class="class">
|
66
|
+
<a href="SimpleBioC/Location.html">SimpleBioC::Location</a>
|
67
|
+
</li>
|
68
|
+
<li class="class">
|
69
|
+
<a href="SimpleBioC/Node.html">SimpleBioC::Node</a>
|
70
|
+
</li>
|
71
|
+
<li class="class">
|
72
|
+
<a href="SimpleBioC/NodeBase.html">SimpleBioC::NodeBase</a>
|
73
|
+
</li>
|
74
|
+
<li class="class">
|
75
|
+
<a href="SimpleBioC/Passage.html">SimpleBioC::Passage</a>
|
76
|
+
</li>
|
77
|
+
<li class="class">
|
78
|
+
<a href="SimpleBioC/Relation.html">SimpleBioC::Relation</a>
|
79
|
+
</li>
|
80
|
+
<li class="class">
|
81
|
+
<a href="SimpleBioC/Sentence.html">SimpleBioC::Sentence</a>
|
82
|
+
</li>
|
83
|
+
|
84
|
+
</ul>
|
85
|
+
|
86
|
+
<h2 id="methods">Methods</h2>
|
87
|
+
<ul>
|
88
|
+
|
89
|
+
<li class="method"><a href="SimpleBioC/Annotation.html#method-c-new">::new — SimpleBioC::Annotation</a>
|
90
|
+
|
91
|
+
<li class="method"><a href="SimpleBioC/Passage.html#method-c-new">::new — SimpleBioC::Passage</a>
|
92
|
+
|
93
|
+
<li class="method"><a href="SimpleBioC/Collection.html#method-c-new">::new — SimpleBioC::Collection</a>
|
94
|
+
|
95
|
+
<li class="method"><a href="SimpleBioC/NodeBase.html#method-c-new">::new — SimpleBioC::NodeBase</a>
|
96
|
+
|
97
|
+
<li class="method"><a href="SimpleBioC/Document.html#method-c-new">::new — SimpleBioC::Document</a>
|
98
|
+
|
99
|
+
<li class="method"><a href="SimpleBioC/Relation.html#method-c-new">::new — SimpleBioC::Relation</a>
|
100
|
+
|
101
|
+
<li class="method"><a href="SimpleBioC/Node.html#method-c-new">::new — SimpleBioC::Node</a>
|
102
|
+
|
103
|
+
<li class="method"><a href="SimpleBioC/Location.html#method-c-new">::new — SimpleBioC::Location</a>
|
104
|
+
|
105
|
+
<li class="method"><a href="SimpleBioC/Sentence.html#method-c-new">::new — SimpleBioC::Sentence</a>
|
106
|
+
|
107
|
+
<li class="method"><a href="SimpleBioC/Document.html#method-i-adjust_ref">#adjust_ref — SimpleBioC::Document</a>
|
108
|
+
|
109
|
+
<li class="method"><a href="SimpleBioC/Relation.html#method-i-adjust_ref">#adjust_ref — SimpleBioC::Relation</a>
|
110
|
+
|
111
|
+
<li class="method"><a href="SimpleBioC/Node.html#method-i-adjust_ref">#adjust_ref — SimpleBioC::Node</a>
|
112
|
+
|
113
|
+
<li class="method"><a href="SimpleBioC/Document.html#method-i-each_relation">#each_relation — SimpleBioC::Document</a>
|
114
|
+
|
115
|
+
<li class="method"><a href="SimpleBioC/Sentence.html#method-i-each_relation">#each_relation — SimpleBioC::Sentence</a>
|
116
|
+
|
117
|
+
<li class="method"><a href="SimpleBioC/Passage.html#method-i-each_relation">#each_relation — SimpleBioC::Passage</a>
|
118
|
+
|
119
|
+
<li class="method"><a href="SimpleBioC/Sentence.html#method-i-find_node">#find_node — SimpleBioC::Sentence</a>
|
120
|
+
|
121
|
+
<li class="method"><a href="SimpleBioC/Document.html#method-i-find_node">#find_node — SimpleBioC::Document</a>
|
122
|
+
|
123
|
+
<li class="method"><a href="SimpleBioC/Passage.html#method-i-find_node">#find_node — SimpleBioC::Passage</a>
|
124
|
+
|
125
|
+
<li class="method"><a href="SimpleBioC.html#method-i-from_xml">#from_xml — SimpleBioC</a>
|
126
|
+
|
127
|
+
<li class="method"><a href="BioCReader.html#method-i-read">#read — BioCReader</a>
|
128
|
+
|
129
|
+
<li class="method"><a href="BioCReader.html#method-i-read_annotation">#read_annotation — BioCReader</a>
|
130
|
+
|
131
|
+
<li class="method"><a href="BioCReader.html#method-i-read_collection">#read_collection — BioCReader</a>
|
132
|
+
|
133
|
+
<li class="method"><a href="BioCReader.html#method-i-read_document">#read_document — BioCReader</a>
|
134
|
+
|
135
|
+
<li class="method"><a href="BioCReader.html#method-i-read_infon">#read_infon — BioCReader</a>
|
136
|
+
|
137
|
+
<li class="method"><a href="BioCReader.html#method-i-read_int">#read_int — BioCReader</a>
|
138
|
+
|
139
|
+
<li class="method"><a href="BioCReader.html#method-i-read_location">#read_location — BioCReader</a>
|
140
|
+
|
141
|
+
<li class="method"><a href="BioCReader.html#method-i-read_node">#read_node — BioCReader</a>
|
142
|
+
|
143
|
+
<li class="method"><a href="BioCReader.html#method-i-read_passage">#read_passage — BioCReader</a>
|
144
|
+
|
145
|
+
<li class="method"><a href="BioCReader.html#method-i-read_recursive">#read_recursive — BioCReader</a>
|
146
|
+
|
147
|
+
<li class="method"><a href="BioCReader.html#method-i-read_relation">#read_relation — BioCReader</a>
|
148
|
+
|
149
|
+
<li class="method"><a href="BioCReader.html#method-i-read_sentence">#read_sentence — BioCReader</a>
|
150
|
+
|
151
|
+
<li class="method"><a href="BioCReader.html#method-i-read_text">#read_text — BioCReader</a>
|
152
|
+
|
153
|
+
<li class="method"><a href="SimpleBioC/Node.html#method-i-to_c">#to_c — SimpleBioC::Node</a>
|
154
|
+
|
155
|
+
<li class="method"><a href="SimpleBioC/Collection.html#method-i-to_c">#to_c — SimpleBioC::Collection</a>
|
156
|
+
|
157
|
+
<li class="method"><a href="SimpleBioC/Relation.html#method-i-to_c">#to_c — SimpleBioC::Relation</a>
|
158
|
+
|
159
|
+
<li class="method"><a href="SimpleBioC/Sentence.html#method-i-to_c">#to_c — SimpleBioC::Sentence</a>
|
160
|
+
|
161
|
+
<li class="method"><a href="SimpleBioC/Document.html#method-i-to_s">#to_s — SimpleBioC::Document</a>
|
162
|
+
|
163
|
+
<li class="method"><a href="SimpleBioC/Passage.html#method-i-to_s">#to_s — SimpleBioC::Passage</a>
|
164
|
+
|
165
|
+
<li class="method"><a href="SimpleBioC/Location.html#method-i-to_s">#to_s — SimpleBioC::Location</a>
|
166
|
+
|
167
|
+
<li class="method"><a href="SimpleBioC/Annotation.html#method-i-to_s">#to_s — SimpleBioC::Annotation</a>
|
168
|
+
|
169
|
+
<li class="method"><a href="SimpleBioC.html#method-i-to_xml">#to_xml — SimpleBioC</a>
|
170
|
+
|
171
|
+
<li class="method"><a href="BioCWriter.html#method-i-write">#write — BioCWriter</a>
|
172
|
+
|
173
|
+
<li class="method"><a href="BioCWriter.html#method-i-write_annotation">#write_annotation — BioCWriter</a>
|
174
|
+
|
175
|
+
<li class="method"><a href="BioCWriter.html#method-i-write_collection">#write_collection — BioCWriter</a>
|
176
|
+
|
177
|
+
<li class="method"><a href="BioCWriter.html#method-i-write_document">#write_document — BioCWriter</a>
|
178
|
+
|
179
|
+
<li class="method"><a href="BioCWriter.html#method-i-write_infon">#write_infon — BioCWriter</a>
|
180
|
+
|
181
|
+
<li class="method"><a href="BioCWriter.html#method-i-write_location">#write_location — BioCWriter</a>
|
182
|
+
|
183
|
+
<li class="method"><a href="BioCWriter.html#method-i-write_node">#write_node — BioCWriter</a>
|
184
|
+
|
185
|
+
<li class="method"><a href="BioCWriter.html#method-i-write_passage">#write_passage — BioCWriter</a>
|
186
|
+
|
187
|
+
<li class="method"><a href="BioCWriter.html#method-i-write_relation">#write_relation — BioCWriter</a>
|
188
|
+
|
189
|
+
<li class="method"><a href="BioCWriter.html#method-i-write_sentence">#write_sentence — BioCWriter</a>
|
190
|
+
|
191
|
+
</ul>
|
192
|
+
|
193
|
+
|
194
|
+
<footer id="validator-badges">
|
195
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
196
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
|
197
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
198
|
+
</footer>
|
199
|
+
|
data/lib/simple_bioc.rb
CHANGED
@@ -2,12 +2,16 @@ require "simple_bioc/version"
|
|
2
2
|
require "simple_bioc/bioc_reader"
|
3
3
|
require "simple_bioc/bioc_writer"
|
4
4
|
|
5
|
+
# SimpleBioC main library
|
5
6
|
module SimpleBioC
|
6
7
|
module_function
|
8
|
+
|
9
|
+
# parse a BioC XML file in the given path and convert it into a collection instance
|
7
10
|
def from_xml(file_path)
|
8
11
|
BioCReader.read(file_path)
|
9
12
|
end
|
10
13
|
|
14
|
+
# convert a collection instance to a BioC XML text
|
11
15
|
def to_xml(collection)
|
12
16
|
BioCWriter.write(collection)
|
13
17
|
end
|
@@ -1,11 +1,15 @@
|
|
1
1
|
require 'simple_bioc/node_base'
|
2
|
+
module SimpleBioC
|
3
|
+
class Annotation < NodeBase
|
4
|
+
attr_accessor :locations, :text
|
2
5
|
|
3
|
-
|
4
|
-
|
6
|
+
def initialize(parent)
|
7
|
+
super(parent)
|
8
|
+
@locations = []
|
9
|
+
end
|
5
10
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@locations = []
|
11
|
+
def to_s
|
12
|
+
"Annotation:#{id} #{text}"
|
13
|
+
end
|
10
14
|
end
|
11
15
|
end
|
@@ -14,7 +14,7 @@ module BioCReader
|
|
14
14
|
if xml.nil?
|
15
15
|
fail 'Wrong format'
|
16
16
|
end
|
17
|
-
collection = Collection.new
|
17
|
+
collection = SimpleBioC::Collection.new
|
18
18
|
read_collection(xml, collection)
|
19
19
|
end
|
20
20
|
|
@@ -36,7 +36,7 @@ module BioCReader
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def read_recursive(xml, obj, name)
|
39
|
-
target_class =
|
39
|
+
target_class = SimpleBioC.const_get(name.capitalize)
|
40
40
|
xml.xpath(name).each do |node|
|
41
41
|
instance = target_class.new(obj)
|
42
42
|
send(:"read_#{name}", node, instance)
|
@@ -1,15 +1,17 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module SimpleBioC
|
2
|
+
class Collection
|
3
|
+
attr_accessor :documents, :infons, :source, :date, :key
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
def initialize
|
6
|
+
@documents = []
|
7
|
+
@infons = {}
|
8
|
+
@source = ""
|
9
|
+
@date = ""
|
10
|
+
@key = ""
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
def to_c
|
14
|
+
"Collection(source: #{source}, date: #{date}, key: #{key})"
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
data/lib/simple_bioc/document.rb
CHANGED
@@ -1,29 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module SimpleBioC
|
2
|
+
class Document
|
3
|
+
# attribute
|
4
|
+
attr_accessor :id, :infons, :passages, :relations
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
@passages = []
|
8
|
-
@relations = []
|
9
|
-
@collection = parent
|
10
|
-
end
|
6
|
+
# parent
|
7
|
+
attr_reader :collection
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
def initialize(parent)
|
10
|
+
@infons = {}
|
11
|
+
@passages = []
|
12
|
+
@relations = []
|
13
|
+
@collection = parent
|
17
14
|
end
|
18
|
-
nil
|
19
|
-
end
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
def find_node(id)
|
17
|
+
relations.each{|r| return r if r.id == id}
|
18
|
+
passages.each do |p|
|
19
|
+
ret = p.find_node(id)
|
20
|
+
return ret unless ret.nil?
|
21
|
+
end
|
22
|
+
nil
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def adjust_ref
|
26
|
+
each_relation{|r| r.adjust_ref}
|
27
|
+
end
|
28
|
+
|
29
|
+
def each_relation
|
30
|
+
relations.each{|r| yield r}
|
31
|
+
passages.each{|p| p.each_relation{|r| yield r}}
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_s
|
35
|
+
"Document:#{id}"
|
36
|
+
end
|
28
37
|
end
|
29
38
|
end
|
data/lib/simple_bioc/location.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module SimpleBioC
|
2
|
+
class Location
|
3
|
+
attr_accessor :offset, :length
|
4
|
+
attr_reader :annotation
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def initialize(parent)
|
7
|
+
@infons = {}
|
8
|
+
@locations = []
|
9
|
+
@annotation = parent
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
"Location @#{offset}:#{length}"
|
14
|
+
end
|
9
15
|
end
|
10
16
|
end
|
data/lib/simple_bioc/node.rb
CHANGED
@@ -1,12 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module SimpleBioC
|
2
|
+
class Node
|
3
|
+
attr_accessor :refid, :role
|
4
|
+
attr_reader :ref, :relation
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
def initialize(parent)
|
7
|
+
@relation = parent
|
8
|
+
end
|
9
|
+
|
10
|
+
def adjust_ref
|
11
|
+
@ref = relation.document.find_node(refid)
|
12
|
+
end
|
8
13
|
|
9
|
-
|
10
|
-
|
14
|
+
def to_c
|
15
|
+
"Node @#{refid}: #{role})"
|
16
|
+
end
|
11
17
|
end
|
12
18
|
end
|
@@ -1,14 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module SimpleBioC
|
2
|
+
# NodeBase is not a BioC DTD entity. This is a super class of Annotation & Relation.
|
3
|
+
class NodeBase
|
4
|
+
attr_accessor :id, :infons
|
5
|
+
attr_reader :document, :passage, :sentence
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
def initialize(parent)
|
8
|
+
@infons = {}
|
9
|
+
@document = parent if parent.is_a? Document
|
10
|
+
@passage = parent if parent.is_a? Passage
|
11
|
+
@sentence = parent if parent.is_a? Sentence
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
@passage = @sentence.passage unless @sentence.nil?
|
14
|
+
@document = @passage.document unless @passage.nil?
|
15
|
+
end
|
13
16
|
end
|
14
17
|
end
|
data/lib/simple_bioc/passage.rb
CHANGED
@@ -1,29 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module SimpleBioC
|
2
|
+
class Passage
|
3
|
+
attr_accessor :offset, :text, :infons, :sentences, :annotations, :relations
|
4
|
+
attr_reader :document
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
def initialize(parent)
|
7
|
+
@infons = {}
|
8
|
+
@sentences = []
|
9
|
+
@annotations = []
|
10
|
+
@relations = []
|
11
|
+
@document = parent
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
-
def find_node(id)
|
17
|
-
(relations+annotations).each{|n| return n if n.id == id}
|
18
|
-
sentences.each do |s|
|
19
|
-
ret = s.find_node(id)
|
20
|
-
return ret unless ret.nil?
|
14
|
+
def to_s
|
15
|
+
"Passage @#{offset}: #{text}"
|
21
16
|
end
|
22
|
-
nil
|
23
|
-
end
|
24
17
|
|
25
|
-
|
26
|
-
|
27
|
-
|
18
|
+
def find_node(id)
|
19
|
+
(relations+annotations).each{|n| return n if n.id == id}
|
20
|
+
sentences.each do |s|
|
21
|
+
ret = s.find_node(id)
|
22
|
+
return ret unless ret.nil?
|
23
|
+
end
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
|
27
|
+
def each_relation
|
28
|
+
relations.each{|r| yield r}
|
29
|
+
sentences.each{|s| s.each_relation{|r| yield r}}
|
30
|
+
end
|
28
31
|
end
|
29
32
|
end
|