2016-11-07 14:12:37 -08:00
|
|
|
.. _lang-packs:
|
|
|
|
|
2019-06-22 17:29:26 -07:00
|
|
|
====================================
|
2016-09-06 13:52:40 -07:00
|
|
|
Installing additional language packs
|
|
|
|
====================================
|
|
|
|
|
2020-02-25 22:23:58 -08:00
|
|
|
OCRmyPDF uses Tesseract for OCR, and relies on its language packs for all languages.
|
|
|
|
On most platforms, English is installed with Tesseract by default, but not always.
|
2016-09-06 13:52:40 -07:00
|
|
|
|
2019-06-22 17:29:26 -07:00
|
|
|
Tesseract supports `most
|
|
|
|
languages <https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#languages>`__.
|
2020-02-25 22:23:58 -08:00
|
|
|
Languages are identified by standardized three-letter codes (called ISO 639-2 Alpha-3).
|
|
|
|
Tesseract's documentation also lists the three-letter code for your language.
|
|
|
|
Some are anglicized, e.g. Spanish is ``spa`` rather than ``esp``, while others
|
2021-05-09 10:03:13 +02:00
|
|
|
are not, e.g. German is ``deu`` and French is ``fra``.
|
2020-02-25 22:23:58 -08:00
|
|
|
|
2021-05-09 10:03:13 +02:00
|
|
|
After you have installed a language pack, you can use it with ``ocrmypdf -l <language>``,
|
2020-02-25 22:23:58 -08:00
|
|
|
for example ``ocrmypdf -l spa``. For multilingual documents, you can specify
|
|
|
|
all languages to be expected, e.g. ``ocrmypdf -l eng+fra`` for English and French.
|
|
|
|
English is assumed by default unless other language(s) are specified.
|
2016-09-06 13:52:40 -07:00
|
|
|
|
2019-06-22 17:29:26 -07:00
|
|
|
For Linux users, you can often find packages that provide language
|
|
|
|
packs:
|
2016-09-06 13:52:40 -07:00
|
|
|
|
|
|
|
Debian and Ubuntu users
|
2019-06-22 17:29:26 -07:00
|
|
|
=======================
|
2016-09-06 13:52:40 -07:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
# Display a list of all Tesseract language packs
|
|
|
|
apt-cache search tesseract-ocr
|
|
|
|
|
2018-10-14 16:28:50 -04:00
|
|
|
# Install Chinese Simplified language pack
|
|
|
|
apt-get install tesseract-ocr-chi-sim
|
|
|
|
|
2019-06-22 17:29:26 -07:00
|
|
|
You can then pass the ``-l LANG`` argument to OCRmyPDF to give a hint as
|
|
|
|
to what languages it should search for. Multiple languages can be
|
2021-05-09 10:03:13 +02:00
|
|
|
requested using either ``-l eng+fra`` (English and French) or
|
|
|
|
``-l eng -l fra``.
|
2016-09-06 13:52:40 -07:00
|
|
|
|
2018-10-14 16:28:50 -04:00
|
|
|
Fedora users
|
2019-06-22 17:29:26 -07:00
|
|
|
============
|
2018-10-14 16:28:50 -04:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
# Display a list of all Tesseract language packs
|
|
|
|
dnf search tesseract
|
|
|
|
|
|
|
|
# Install Chinese Simplified language pack
|
|
|
|
dnf install tesseract-langpack-chi_sim
|
|
|
|
|
2019-06-22 17:29:26 -07:00
|
|
|
You can then pass the ``-l LANG`` argument to OCRmyPDF to give a hint as
|
|
|
|
to what languages it should search for. Multiple languages can be
|
2021-05-09 10:03:13 +02:00
|
|
|
requested using either ``-l eng+fra`` (English and French) or
|
|
|
|
``-l eng -l fra``.
|
2018-10-14 16:28:50 -04:00
|
|
|
|
2017-01-26 23:02:44 -08:00
|
|
|
macOS users
|
2019-06-22 17:29:26 -07:00
|
|
|
===========
|
2016-09-06 13:52:40 -07:00
|
|
|
|
2019-06-22 17:29:26 -07:00
|
|
|
You can install additional language packs by
|
|
|
|
:ref:`installing Tesseract using Homebrew with all language packs <macos-all-languages>`.
|
2016-09-06 13:52:40 -07:00
|
|
|
|
|
|
|
Docker users
|
2019-06-22 17:29:26 -07:00
|
|
|
============
|
2016-09-06 13:52:40 -07:00
|
|
|
|
2019-06-22 17:29:26 -07:00
|
|
|
Users of the OCRmyPDF Docker image should install language packs into a
|
|
|
|
derived Docker image as
|
|
|
|
:ref:`described in that section <docker-lang-packs>`.
|
2019-12-09 21:39:01 -08:00
|
|
|
|
|
|
|
Windows users
|
|
|
|
=============
|
|
|
|
|
2021-03-27 00:13:28 +01:00
|
|
|
The Tesseract installer provided by Chocolatey currently includes only English language.
|
|
|
|
To install other languages, download the respective language pack (``.traineddata`` file)
|
|
|
|
from https://github.com/tesseract-ocr/tessdata/ and place it in
|
|
|
|
``C:\\Program Files\\Tesseract-OCR\\tessdata`` (or wherever Tesseract OCR is installed).
|