Sha256: fdaceb92242e102ba7f89bcf7e60dcc90acb9644c1ebc9eb569ac52e0ee29add

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

require 'rbbt/ner/annotations'
require 'rbbt/ner/annotations/named_entity'
require 'rbbt/ner/annotations/annotated'

class NER
  def entities(text, protect = false, *args)
    case
    when Array === text
      text.collect do |element|
        matches = entities(element, protect, *args)
        matches.each{|match|
          match.offset += element.offset if match.offset and element.offset
        }
        matches
      end.flatten
    when (Annotated === text and protect)
      entities(text.split_segments(true), protect, *args)
    else
      match(text, *args)
    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbbt-text-0.5.0 lib/rbbt/ner/NER.rb