Class: Mitier::Extractor

Inherits:
Object
  • Object
show all
Defined in:
lib/mitier/extractor.rb

Defined Under Namespace

Classes: ModelNotLoaded

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Extractor

Returns a new instance of Extractor.



7
8
9
# File 'lib/mitier/extractor.rb', line 7

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/mitier/extractor.rb', line 3

def path
  @path
end

Instance Method Details

#loadObject



11
12
13
14
# File 'lib/mitier/extractor.rb', line 11

def load
  @extractor = Mitier::Wrapper.mitie_load_named_entity_extractor @path
  self
end

#process_ner(text) ⇒ Object

Raises:



16
17
18
19
# File 'lib/mitier/extractor.rb', line 16

def process_ner(text)
  raise ModelNotLoaded unless @extractor
  Ner.new(@extractor, text).process
end