Class: NER

Inherits:
Object
  • Object
show all
Defined in:
lib/rbbt/ner/NER.rb

Instance Method Summary collapse

Instance Method Details

#entities(text, protect = false, *args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rbbt/ner/NER.rb', line 6

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 (Segmented === text and protect)
    entities(text.split_segments(true), protect, *args)
  else
    match(text, *args)
  end
end