Class: SimpleBioC::Sentence
- Inherits:
-
Object
- Object
- SimpleBioC::Sentence
- Defined in:
- lib/simple_bioc/sentence.rb
Instance Attribute Summary collapse
-
#annotations ⇒ Object
Returns the value of attribute annotations.
-
#infons ⇒ Object
Returns the value of attribute infons.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#passage ⇒ Object
readonly
Returns the value of attribute passage.
-
#relations ⇒ Object
Returns the value of attribute relations.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #all_annotations(ret) ⇒ Object
- #all_relations(ret) ⇒ Object
- #each_relation ⇒ Object
- #find_node(id) ⇒ Object
-
#initialize(parent) ⇒ Sentence
constructor
A new instance of Sentence.
- #to_c ⇒ Object
Constructor Details
#initialize(parent) ⇒ Sentence
Returns a new instance of Sentence.
6 7 8 9 10 11 |
# File 'lib/simple_bioc/sentence.rb', line 6 def initialize(parent) @infons = {} @annotations = [] @relations = [] @passage = parent end |
Instance Attribute Details
#annotations ⇒ Object
Returns the value of attribute annotations.
3 4 5 |
# File 'lib/simple_bioc/sentence.rb', line 3 def annotations @annotations end |
#infons ⇒ Object
Returns the value of attribute infons.
3 4 5 |
# File 'lib/simple_bioc/sentence.rb', line 3 def infons @infons end |
#offset ⇒ Object
Returns the value of attribute offset.
3 4 5 |
# File 'lib/simple_bioc/sentence.rb', line 3 def offset @offset end |
#passage ⇒ Object (readonly)
Returns the value of attribute passage.
4 5 6 |
# File 'lib/simple_bioc/sentence.rb', line 4 def passage @passage end |
#relations ⇒ Object
Returns the value of attribute relations.
3 4 5 |
# File 'lib/simple_bioc/sentence.rb', line 3 def relations @relations end |
#text ⇒ Object
Returns the value of attribute text.
3 4 5 |
# File 'lib/simple_bioc/sentence.rb', line 3 def text @text end |
Instance Method Details
#all_annotations(ret) ⇒ Object
22 23 24 |
# File 'lib/simple_bioc/sentence.rb', line 22 def all_annotations(ret) @annotations.each{|a| ret << a} end |
#all_relations(ret) ⇒ Object
26 27 28 |
# File 'lib/simple_bioc/sentence.rb', line 26 def all_relations(ret) @relations.each{|r| ret << r} end |
#each_relation ⇒ Object
18 19 20 |
# File 'lib/simple_bioc/sentence.rb', line 18 def each_relation @relations.each{|r| yield r} end |
#find_node(id) ⇒ Object
13 14 15 16 |
# File 'lib/simple_bioc/sentence.rb', line 13 def find_node(id) (@relations+@annotations).each{|n| return n if n.id == id} nil end |
#to_c ⇒ Object
30 31 32 |
# File 'lib/simple_bioc/sentence.rb', line 30 def to_c "Sentence @#{@offset}: #{@text}" end |