Sha256: 2719ce5d2abd66775fec2547da277c728b909a7f4d9d596f8c82155339ae571a
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module SimpleBioC class Passage attr_accessor :offset, :text, :infons, :sentences, :annotations, :relations attr_reader :document def initialize(parent) @infons = {} @sentences = [] @annotations = [] @relations = [] @document = parent end def to_s "Passage @#{@offset}: #{@text}" end def find_node(id) (@relations+@annotations).each{|n| return n if n.id == id} @sentences.each do |s| ret = s.find_node(id) return ret unless ret.nil? end nil end def each_relation @relations.each{|r| yield r} @sentences.each{|s| s.each_relation{|r| yield r}} end def all_texts return text unless self.text.nil? @sentences.map{|s| s.text}.join(" ") end def all_annotations(ret) @annotations.each{|a| ret << a} @sentences.each{|s| s.all_annotations(ret)} end def all_relations(ret) @relations.each{|r| ret << r} @sentences.each{|s| s.all_relations(ret)} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_bioc-0.0.24 | lib/simple_bioc/passage.rb |
simple_bioc-0.0.23 | lib/simple_bioc/passage.rb |