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

#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



22
23
24
# File 'lib/simple_bioc/sentence.rb', line 22

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