mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-27 07:25:16 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfe05aa05b |
No files matched your search
@@ -23,6 +23,7 @@ dependencies = [
|
||||
"channels~=4.2",
|
||||
"channels-redis~=4.2",
|
||||
"concurrent-log-handler~=0.9.25",
|
||||
"cryptography>=50",
|
||||
"dateparser~=1.4",
|
||||
# WARNING: django does not use semver.
|
||||
# Only patch versions are guaranteed to not introduce breaking changes.
|
||||
@@ -46,6 +47,7 @@ dependencies = [
|
||||
"flower>=2.0.1,<2.3",
|
||||
"gotenberg-client[httpx]~=1.0",
|
||||
"httpx-oauth~=0.17",
|
||||
"humanize>=4.15",
|
||||
"ijson>=3.5.1",
|
||||
"imap-tools>=1.14,<1.16",
|
||||
"jinja2~=3.1.6",
|
||||
@@ -56,10 +58,13 @@ dependencies = [
|
||||
"llama-index-embeddings-openai-like>=0.2.2",
|
||||
"llama-index-llms-ollama>=0.9.1",
|
||||
"llama-index-llms-openai-like>=0.7.1",
|
||||
"lxml>=6.1",
|
||||
"ocrmypdf[heic]>=17.12,<17.13",
|
||||
"ollama>=0.6.1",
|
||||
"openai>=2.48",
|
||||
"pathvalidate~=3.3.1",
|
||||
"pdf2image~=1.17.0",
|
||||
"pikepdf>=10.13",
|
||||
"python-dateutil~=2.9.0",
|
||||
"python-dotenv~=1.2.1",
|
||||
"python-gnupg~=0.5.4",
|
||||
|
||||
@@ -12,11 +12,6 @@ from paperless.utils import ocr_to_dateparser_languages
|
||||
pytest.param("eng", ["en"], id="single-language"),
|
||||
pytest.param("fra+ita+lao", ["fr", "it", "lo"], id="multiple-languages"),
|
||||
pytest.param("fil", ["fil"], id="no-two-letter-equivalent"),
|
||||
pytest.param(
|
||||
"afr+vie+kan+chr+mkd", # codespell:ignore
|
||||
["af", "vi", "kn", "chr", "mk"],
|
||||
id="previously-unmapped-languages",
|
||||
),
|
||||
pytest.param(
|
||||
"aze_cyrl+srp_latn",
|
||||
["az-Cyrl", "sr-Latn"],
|
||||
@@ -54,19 +49,6 @@ def test_ocr_to_dateparser_languages(ocr_language: str, expected: list[str]) ->
|
||||
assert sorted(ocr_to_dateparser_languages(ocr_language)) == sorted(expected)
|
||||
|
||||
|
||||
def test_ocr_to_dateparser_map_values_supported_by_dateparser() -> None:
|
||||
from dateparser.languages.loader import LocaleDataLoader
|
||||
|
||||
loader = LocaleDataLoader()
|
||||
unsupported = []
|
||||
for ocr_code, dateparser_code in utils.OCR_TO_DATEPARSER_LANGUAGES.items():
|
||||
try:
|
||||
loader.get_locale_map(locales=[dateparser_code])
|
||||
except Exception:
|
||||
unsupported.append((ocr_code, dateparser_code))
|
||||
assert unsupported == []
|
||||
|
||||
|
||||
def test_ocr_to_dateparser_languages_exception(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
|
||||
+16
-16
@@ -2,18 +2,19 @@ import logging
|
||||
|
||||
logger = logging.getLogger("paperless.utils")
|
||||
|
||||
# Translation map from languages supported by Tesseract OCR
|
||||
# to languages supported by dateparser.
|
||||
# To add a language, make sure it is supported by both libraries.
|
||||
# The ISO 639-2 will help you link a 3-char to 2-char language code.
|
||||
# Links:
|
||||
# - Tesseract languages: https://tesseract-ocr.github.io/tessdoc/Data-Files-in-different-versions.html
|
||||
# - Python dateparser languages: https://dateparser.readthedocs.io/en/latest/supported_locales.html
|
||||
# - ISO 639-2: https://www.loc.gov/standards/iso639-2/php/code_list.php
|
||||
OCR_TO_DATEPARSER_LANGUAGES = {
|
||||
# These dateparser languages have no equivalent in any Tesseract release
|
||||
# (checked against tessdata, tessdata_best and tessdata_fast), so they cannot
|
||||
# be reached from the OCR language. Set PAPERLESS_DATE_PARSER_LANGUAGES to use them:
|
||||
"""
|
||||
Translation map from languages supported by Tesseract OCR
|
||||
to languages supported by dateparser.
|
||||
To add a language, make sure it is supported by both libraries.
|
||||
The ISO 639-2 will help you link a 3-char to 2-char language code.
|
||||
Links:
|
||||
- Tesseract languages: https://tesseract-ocr.github.io/tessdoc/Data-Files-in-different-versions.html
|
||||
- Python dateparser languages: https://dateparser.readthedocs.io/en/latest/supported_locales.html
|
||||
- ISO 639-2: https://www.loc.gov/standards/iso639-2/php/code_list.php
|
||||
"""
|
||||
# TODO check these Dateparser languages as they are not referenced on the ISO639-2 standard,
|
||||
# so we didn't find the equivalent in Tesseract:
|
||||
# agq, asa, bez, brx, cgg, ckb, dav, dje, dyo, ebu, guz, jgo, jmc, kde, kea, khq, kln,
|
||||
# ksb, ksf, ksh, lag, lkt, lrc, luy, mer, mfe, mgh, mgo, mua, mzn, naq, nmg, nnh, nus,
|
||||
# rof, rwk, saq, sbp, she, ses, shi, teo, twq, tzm, vun, wae, xog, yav, yue
|
||||
@@ -21,6 +22,7 @@ OCR_TO_DATEPARSER_LANGUAGES = {
|
||||
"amh": "am",
|
||||
"ara": "ar",
|
||||
"asm": "as",
|
||||
"ast": "ast",
|
||||
"aze": "az",
|
||||
"bel": "be",
|
||||
"bul": "bg",
|
||||
@@ -29,7 +31,7 @@ OCR_TO_DATEPARSER_LANGUAGES = {
|
||||
"bre": "br",
|
||||
"bos": "bs",
|
||||
"cat": "ca",
|
||||
"chr": "chr",
|
||||
"cher": "chr",
|
||||
"ces": "cs",
|
||||
"cym": "cy",
|
||||
"dan": "da",
|
||||
@@ -63,21 +65,19 @@ OCR_TO_DATEPARSER_LANGUAGES = {
|
||||
"kat": "ka",
|
||||
"kaz": "kk",
|
||||
"khm": "km",
|
||||
"kan": "kn",
|
||||
"knda": "kn",
|
||||
"kor": "ko",
|
||||
"kir": "ky",
|
||||
"ltz": "lb",
|
||||
"lao": "lo",
|
||||
"lit": "lt",
|
||||
"lav": "lv",
|
||||
"mkd": "mk",
|
||||
"mal": "ml",
|
||||
"mon": "mn",
|
||||
"mar": "mr",
|
||||
"msa": "ms",
|
||||
"mlt": "mt",
|
||||
"mya": "my",
|
||||
"nor": "nb",
|
||||
"nep": "ne",
|
||||
"nld": "nl",
|
||||
"ori": "or",
|
||||
@@ -106,7 +106,7 @@ OCR_TO_DATEPARSER_LANGUAGES = {
|
||||
"ukr": "uk",
|
||||
"urd": "ur",
|
||||
"uzb": "uz",
|
||||
"vie": "vi", # codespell:ignore
|
||||
"via": "vi",
|
||||
"yid": "yi",
|
||||
"yor": "yo",
|
||||
"chi": "zh",
|
||||
|
||||
@@ -2516,6 +2516,7 @@ dependencies = [
|
||||
{ name = "channels" },
|
||||
{ name = "channels-redis" },
|
||||
{ name = "concurrent-log-handler" },
|
||||
{ name = "cryptography" },
|
||||
{ name = "dateparser" },
|
||||
{ name = "django" },
|
||||
{ name = "django-allauth", extra = ["mfa", "socialaccount"] },
|
||||
@@ -2537,6 +2538,7 @@ dependencies = [
|
||||
{ name = "flower" },
|
||||
{ name = "gotenberg-client", extra = ["httpx"] },
|
||||
{ name = "httpx-oauth" },
|
||||
{ name = "humanize" },
|
||||
{ name = "ijson" },
|
||||
{ name = "imap-tools" },
|
||||
{ name = "jinja2" },
|
||||
@@ -2547,10 +2549,13 @@ dependencies = [
|
||||
{ name = "llama-index-embeddings-openai-like" },
|
||||
{ name = "llama-index-llms-ollama" },
|
||||
{ name = "llama-index-llms-openai-like" },
|
||||
{ name = "lxml" },
|
||||
{ name = "ocrmypdf", extra = ["heic"] },
|
||||
{ name = "ollama" },
|
||||
{ name = "openai" },
|
||||
{ name = "pathvalidate" },
|
||||
{ name = "pdf2image" },
|
||||
{ name = "pikepdf" },
|
||||
{ name = "python-dateutil" },
|
||||
{ name = "python-dotenv" },
|
||||
{ name = "python-gnupg" },
|
||||
@@ -2668,6 +2673,7 @@ requires-dist = [
|
||||
{ name = "channels", specifier = "~=4.2" },
|
||||
{ name = "channels-redis", specifier = "~=4.2" },
|
||||
{ name = "concurrent-log-handler", specifier = "~=0.9.25" },
|
||||
{ name = "cryptography", specifier = ">=50.0.0" },
|
||||
{ name = "dateparser", specifier = "~=1.4" },
|
||||
{ name = "django", specifier = "~=5.2.18" },
|
||||
{ name = "django-allauth", extras = ["mfa", "socialaccount"], specifier = "~=65.21.1" },
|
||||
@@ -2690,6 +2696,7 @@ requires-dist = [
|
||||
{ name = "gotenberg-client", extras = ["httpx"], specifier = "~=1.0" },
|
||||
{ name = "granian", extras = ["uvloop"], marker = "extra == 'webserver'", specifier = ">=2.7,<2.9" },
|
||||
{ name = "httpx-oauth", specifier = "~=0.17" },
|
||||
{ name = "humanize", specifier = ">=4.15.0" },
|
||||
{ name = "ijson", specifier = ">=3.5.1" },
|
||||
{ name = "imap-tools", specifier = ">=1.14,<1.16" },
|
||||
{ name = "jinja2", specifier = "~=3.1.6" },
|
||||
@@ -2700,11 +2707,14 @@ requires-dist = [
|
||||
{ name = "llama-index-embeddings-openai-like", specifier = ">=0.2.2" },
|
||||
{ name = "llama-index-llms-ollama", specifier = ">=0.9.1" },
|
||||
{ name = "llama-index-llms-openai-like", specifier = ">=0.7.1" },
|
||||
{ name = "lxml", specifier = ">=6.1.0" },
|
||||
{ name = "mysqlclient", marker = "extra == 'mariadb'", specifier = ">=2.2.7,<2.4" },
|
||||
{ name = "ocrmypdf", extras = ["heic"], specifier = ">=17.12,<17.13" },
|
||||
{ name = "ollama", specifier = ">=0.6.1" },
|
||||
{ name = "openai", specifier = ">=2.48" },
|
||||
{ name = "pathvalidate", specifier = "~=3.3.1" },
|
||||
{ name = "pdf2image", specifier = "~=1.17.0" },
|
||||
{ name = "pikepdf", specifier = ">=10.13" },
|
||||
{ name = "psycopg", extras = ["c", "pool"], marker = "extra == 'postgres'", specifier = "==3.3.8" },
|
||||
{ name = "psycopg-c", marker = "python_full_version == '3.12.*' and platform_machine == 'aarch64' and sys_platform == 'linux' and extra == 'postgres'", url = "https://github.com/paperless-ngx/builder/releases/download/psycopg-trixie-3.3.8/psycopg_c-3.3.8-cp312-cp312-manylinux_2_38_aarch64.whl" },
|
||||
{ name = "psycopg-c", marker = "python_full_version == '3.14.*' and platform_machine == 'aarch64' and sys_platform == 'linux' and extra == 'postgres'", url = "https://github.com/paperless-ngx/builder/releases/download/psycopg-trixie-3.3.8/psycopg_c-3.3.8-cp314-cp314-manylinux_2_38_aarch64.whl" },
|
||||
|
||||
Reference in new issue
Block a user