Module: OcrFile::OcrEngines::CloudVision
- Extended by:
- CloudVision
- Included in:
- CloudVision
- Defined in:
- lib/ocr-file/ocr_engines/cloud_vision.rb
Constant Summary collapse
- DEFAULT_LANGUAGE =
'en'
- TEXT_DETECTION =
'TEXT_DETECTION'
- DOCUMENT_TEXT_DETECTION =
Used for low-quality images
'DOCUMENT_TEXT_DETECTION'
Instance Method Summary collapse
-
#id ⇒ Object
Used for dense text documents.
- #ocr_to_pdf(file_path, options: { type_of_ocr: '', image_annotator: nil }) ⇒ Object
- #ocr_to_text(file_path, options: { type_of_ocr: '', image_annotator: nil }) ⇒ Object
Instance Method Details
#id ⇒ Object
Used for dense text documents
12 13 14 |
# File 'lib/ocr-file/ocr_engines/cloud_vision.rb', line 12 def id 'cloud-vision' end |
#ocr_to_pdf(file_path, options: { type_of_ocr: '', image_annotator: nil }) ⇒ Object
24 25 26 27 |
# File 'lib/ocr-file/ocr_engines/cloud_vision.rb', line 24 def ocr_to_pdf(file_path, options: { type_of_ocr: '', image_annotator: nil }) text = ocr_to_text(file_path, options: { type_of_ocr: '', image_annotator: nil }) OcrFile::ImageEngines::PdfEngine.pdf_from_text(text, ) end |
#ocr_to_text(file_path, options: { type_of_ocr: '', image_annotator: nil }) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/ocr-file/ocr_engines/cloud_vision.rb', line 16 def ocr_to_text(file_path, options: { type_of_ocr: '', image_annotator: nil }) type_of_ocr = [:type_of_ocr] image_annotator = [:image_annotator] response = detect_text(type_of_ocr, file_path, image_annotator) extract_text(response) end |