Class: RedactNer::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/redact_ner.rb

Overview

Lightweight value object returned by Recognizer#analyze. Avoids forcing callers to remember Hash keys and gives a nicer #inspect.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#endObject

Returns the value of attribute end

Returns:

  • (Object)

    the current value of end



15
16
17
# File 'lib/redact_ner.rb', line 15

def end
  @end
end

#entity_typeObject Also known as: type

Returns the value of attribute entity_type

Returns:

  • (Object)

    the current value of entity_type



15
16
17
# File 'lib/redact_ner.rb', line 15

def entity_type
  @entity_type
end

#recognizer_nameObject

Returns the value of attribute recognizer_name

Returns:

  • (Object)

    the current value of recognizer_name



15
16
17
# File 'lib/redact_ner.rb', line 15

def recognizer_name
  @recognizer_name
end

#scoreObject

Returns the value of attribute score

Returns:

  • (Object)

    the current value of score



15
16
17
# File 'lib/redact_ner.rb', line 15

def score
  @score
end

#startObject

Returns the value of attribute start

Returns:

  • (Object)

    the current value of start



15
16
17
# File 'lib/redact_ner.rb', line 15

def start
  @start
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



15
16
17
# File 'lib/redact_ner.rb', line 15

def text
  @text
end

Instance Method Details

#lengthObject



26
27
28
# File 'lib/redact_ner.rb', line 26

def length
  self.end - start
end

#to_hObject



30
31
32
# File 'lib/redact_ner.rb', line 30

def to_h
  super
end