Class: AmazonTRP::FieldValue
- Inherits:
-
Object
- Object
- AmazonTRP::FieldValue
- Defined in:
- lib/amazon-textract-parser-ruby.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#geometry ⇒ Object
readonly
Returns the value of attribute geometry.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(block, children, blockMap) ⇒ FieldValue
constructor
A new instance of FieldValue.
- #to_s ⇒ Object
Constructor Details
#initialize(block, children, blockMap) ⇒ FieldValue
Returns a new instance of FieldValue.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/amazon-textract-parser-ruby.rb', line 190 def initialize(block, children, blockMap) @block = block @confidence = block[:confidence] @geometry = Geometry.new(block[:geometry]) @id = block[:id] @text = "" @content = [] t = [] children.each do |eid| wb = blockMap[eid] if wb[:block_type] == "WORD" w = Word.new(wb, blockMap) @content.append(w) t.append(w.text) elsif wb[:block_type] == "SELECTION_ELEMENT" se = SelectionElement.new(wb, blockMap) @content.append(se) t.append(se.selectionStatus) end end @text = t.join(' ') if t end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
188 189 190 |
# File 'lib/amazon-textract-parser-ruby.rb', line 188 def block @block end |
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
183 184 185 |
# File 'lib/amazon-textract-parser-ruby.rb', line 183 def confidence @confidence end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
186 187 188 |
# File 'lib/amazon-textract-parser-ruby.rb', line 186 def content @content end |
#geometry ⇒ Object (readonly)
Returns the value of attribute geometry.
184 185 186 |
# File 'lib/amazon-textract-parser-ruby.rb', line 184 def geometry @geometry end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
185 186 187 |
# File 'lib/amazon-textract-parser-ruby.rb', line 185 def id @id end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
187 188 189 |
# File 'lib/amazon-textract-parser-ruby.rb', line 187 def text @text end |
Instance Method Details
#to_s ⇒ Object
215 216 217 |
# File 'lib/amazon-textract-parser-ruby.rb', line 215 def to_s @text end |