Class: SimpleBioC::Sentence

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_bioc/sentence.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#annotationsObject

Returns the value of attribute annotations.



3
4
5
# File 'lib/simple_bioc/sentence.rb', line 3

def annotations
  @annotations
end

#infonsObject

Returns the value of attribute infons.



3
4
5
# File 'lib/simple_bioc/sentence.rb', line 3

def infons
  @infons
end

#offsetObject

Returns the value of attribute offset.



3
4
5
# File 'lib/simple_bioc/sentence.rb', line 3

def offset
  @offset
end

#passageObject (readonly)

Returns the value of attribute passage.



4
5
6
# File 'lib/simple_bioc/sentence.rb', line 4

def passage
  @passage
end

#relationsObject

Returns the value of attribute relations.



3
4
5
# File 'lib/simple_bioc/sentence.rb', line 3

def relations
  @relations
end

#textObject

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_relationObject



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_cObject



30
31
32
# File 'lib/simple_bioc/sentence.rb', line 30

def to_c
  "Sentence @#{@offset}: #{@text}"
end