# Force OCR

#### Source Codes

`ocbc-ecoffice/enrich/force_ocr/force_ocr.py`

#### Pipelet Arguments

* Minimum number of words
    * Defaults to 50

#### Description

* Check if Squirro Item, `mime_type` == `application/pdf`, has more than a certain number of words. If it doesn't, force OCR.
    1. PDF content is extracted from `files[].content_url`
    2. Extracted content is sanitized by removing HTML tags, stopwords, and special characters
    3. If sanitized extracted content < `min_words`, force OCR by setting the following properties in the Squirro Item:
        * `pdf_ocr:force_ocr` set to `True`
        * `force_ocr` keyword set to `["true"]`
    4. The abovementioned properties are customised to OCtopus project and will be consumed by the "PDF OCR" pipelet with an <b style="color: red;">applied patch</b> on [squirro-platform base code](https://github.com/squirro/ocbc-ecoffice/blob/release/deployment/patches/squirro-platform.patch)
