Class: SimpleBioC::Sentence

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LocationAdjuster

#adjust_annotation_offsets, choose_offset_candidate, find_all_locations

Constructor Details

#initialize(parent) ⇒ Sentence

Returns a new instance of Sentence.



9
10
11
12
13
14
# File 'lib/simple_bioc/sentence.rb', line 9

def initialize(parent)
  @infons = {}
  @annotations = []
  @relations = []
  @passage = parent
end

Instance Attribute Details

#annotationsObject

Returns the value of attribute annotations.



6
7
8
# File 'lib/simple_bioc/sentence.rb', line 6

def annotations
  @annotations
end

#infonsObject

Returns the value of attribute infons.



6
7
8
# File 'lib/simple_bioc/sentence.rb', line 6

def infons
  @infons
end

#offsetObject

Returns the value of attribute offset.



6
7
8
# File 'lib/simple_bioc/sentence.rb', line 6

def offset
  @offset
end

#passageObject (readonly)

Returns the value of attribute passage.



7
8
9
# File 'lib/simple_bioc/sentence.rb', line 7

def passage
  @passage
end

#relationsObject

Returns the value of attribute relations.



6
7
8
# File 'lib/simple_bioc/sentence.rb', line 6

def relations
  @relations
end

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/simple_bioc/sentence.rb', line 6

def text
  @text
end

Instance Method Details

#each_relationObject



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

def each_relation
  relations.each{|r| yield r}
end

#find_node(id) ⇒ Object



16
17
18
19
# File 'lib/simple_bioc/sentence.rb', line 16

def find_node(id)
  (relations+annotations).each{|n| return n if n.id == id}
  nil
end

#to_cObject



25
26
27
# File 'lib/simple_bioc/sentence.rb', line 25

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