# Change Log

List of changes between versions

## 0.4.0

Now it is possible to use OCR models that work on a single line.
Before the pipeline would pass the entire BOX to the OCR model which would make model trained on single line spit out nonsensical results.
Now model can be created with `ocr_mode` sto to `merged`[default] or `single`.
If set to single the non-merged bounding boxes will be passed and the model will afterward stich the text back together by reasonably ordering the Boxes by line/column chunks.

- Modified the API for the `OCRBoxModel._box_detection` should now return a list of dictionaries containing `'merged: tuple[int, int, int, int]` the merged bounding box and `'single': list[tuple[int, int, int, int]]` a list of single bounding boxes that has been merged into `merged`.
- Modified the database models:
  - `OCRModel`: Added `ocr_mode` field with possible values: `merged`[default] `single`.
  - `BBox`: Foreign key `from_ocr` renamed to `from_ocr_merged`
  - `BBox`: Added foreign key `from_ocr_single`
  - `BBox`: Added foreign key `to_merged` (point to the merged `BBox` generated by merging THIS + other boxes)
  - `OCRRun`: Foreign key `result` renamed to `result_merged` (denote the output was from a merged real/mock run)
  - `OCRRun`: Added foreign key `result_single` (denote the output was from a single run)
- Fixed a bug related to Issue #11 where the `%userprofile%/.ocr_translate` folder was not being properly created by the EXE release if it did not exists.

## 0.3.2

restore_missing_spaces with no trie (None for that language) was causing exceptions.
Now the server will skip this step if the trie for the selected language is not found.

## 0.3.1

Removed runaway print statements

## 0.3.0

- All feature for box/ocr/tsl have been moved to plugins in separate packages
- Improved pre-parsing of OCRed text for languages with latin alphabet
  - Introduced a way to remove ghost carachter generated at the begin/end of every string
  - Introduced Trie capability
    - Can use trie to detect if an incorrect work ("helloworld") should be split into multiple valid words (["hello", "world"])
  - Added English word list/freq file.

## 0.2.1

Plugins can now be used to also add models to the database via the following entrypoints:

- `ocr_translate.box_data`
- `ocr_translate.ocr_data`
- `ocr_translate.tsl_data`

The entrypoint should point to a `dict` with the info to create the model.
See [init of plugins](ocr_translate/plugins/__init__.py) for example (care that box/ocr/tsl may need to define different keys).

Information about model-specific language codes is now encoded into an `iso1_map` field of the model.

- Before new models with custom codes in a plugin would require to also edit the main repo and adding a new column to languages in the database.
- Now the plugin can set the `lang_code` to whatever is closest to the model codes, and overwrite what does not match using `iso1_map`, by mapping iso-639-1 codes to the model-specific ones.

Tag only without release as the changes still requires plugins to be baked in with the installer (they cannot be dynamically added without an hack-ish solution).

## 0.2.0

Restructured the code to make it pluginable.
No change should be noticeable from a user experience point of view, but now it should be much easier to contribute to the code (new functionalities can be introduced by writing a plugin without having to modify this codebase).

- The models entries in the database now requires an `entrypoint` field to identify which model should be used to load it.
- The functionality related to `easyocr`, `tesseract` and `hugginface` models have been moved to the `ocr_translate/plugins` folder, and are now plugins (kept in the main codebase to leave an example on how a plugin can work).

## 0.1.4
