Sha256: b65317e4c53aa5bb4859b7db42e27cdced066f38ea66b82af0c8ac22fdd717fc

Contents?: true

Size: 643 Bytes

Versions: 2

Compression:

Stored size: 643 Bytes

Contents

module SimpleBioC
  class Sentence
    attr_accessor :offset, :text, :infons, :annotations, :relations
    attr_reader :passage

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

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

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

    def all_annotations(ret)
      @annotations.each{|a| ret << a}
    end

    def all_relations(ret)
      @relations.each{|r| ret << r}
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_bioc-0.0.24 lib/simple_bioc/sentence.rb
simple_bioc-0.0.23 lib/simple_bioc/sentence.rb