#global commit e2aad9b983032bb1beff9133104a67cdbb87ca4d #global shortcommit %(c=%{commit}; echo ${c:0:7}) #global pre beta.1 Name: tesseract-tessdata-best Version: 4.1.0 Release: 1%{?pre:.%pre}%{?commit:.git%{shortcommit}}%{?dist} Summary: Higher accuracy trained models for Tesseract BuildArch: noarch License: Apache-2.0 URL: https://github.com/tesseract-ocr/tessdata_best %if 0%{?commit:1} Source0: https://github.com/tesseract-ocr/tessdata_best/archive/%{commit}/tessdata_best-%{shortcommit}.tar.gz %else Source0: https://github.com/tesseract-ocr/tessdata_best/archive/%{version}%{?pre:-%pre}/tessdata_best-%{version}%{?pre:-%pre}.tar.gz %endif %description This package contains the best (most accurate) floating-point versions of trained models for the Tesseract Open Source OCR Engine. These models only work with the LSTM OCR engine of Tesseract 4 and above. To use these models instead of the default tessdata_fast, export TESSDATA_PREFIX=/usr/share/tesseract/tessdata_best/ %package doc Summary: Documentation for %{name} %description doc The %{name}-doc package contains the documentation for %{name}. %package osd Summary: Orientation & Script Detection Data for tesseract (best data) BuildArch: noarch Requires: tesseract Requires: %{name}-doc = %{version}-%{release} %description osd Orientation & Script Detection data for the Tesseract Open Source OCR Engine. This is the best (most accurate) floating-point version of the data. # define lang_subpkg macro # m: 3 letter macrolanguage code # l: langcode used in Provides and Supplements tags # n: language name # -m and -n is needed for subpackages, -l is optional # %define lang_subpkg(l:m:n:) \ %define macrolang %{-m:%{-m*}}%{!-m:%{error:3 letter Language code not defined}} \ %define langcode %{-l:%{-l*}}%{!-l:%{error:Language code not defined}} \ %define langname %{-n:%{-n*}}%{!-n:%{error:Language name not defined}} \ \ %package -n tesseract-langpack-%{macrolang}-best\ Summary: %{langname} language data for %{name}\ BuildArch: noarch\ Requires: tesseract\ Requires: %{name}-doc = %{version}-%{release}\ %{-l:Provides: %{name}-langpack-%{langcode} = %{version}-%{release}\ Supplements: (tesseract and langpacks-%{langcode})}\ \ %description -n tesseract-langpack-%{macrolang}-best\ This package contains the best (most accurate) floating-point version of \ the %{langname} language \ trained model for the Tesseract Open Source OCR Engine.\ \ This model only work with the LSTM OCR engine of Tesseract 4 and above.\ To use these models instead of the default tessdata_fast, export \ TESSDATA_PREFIX=/usr/share/tesseract/tessdata_best/\ \ %files -n tesseract-langpack-%{macrolang}-best\ %{_datadir}/tesseract/tessdata_best/%{macrolang}.* # define script_subpkg macro # s: script name # n: package name # %define script_subpkg(s:n:) \ %define scriptname %{-s:%{-s*}}%{!-s:%{error:Script name defined}} \ %define filename %{-n:%{-n*}}%{!-n:%{error:Package name not defined}} \ %define pkgname %(echo %filename | tr '[:upper:]' '[:lower:]') \ \ %package -n tesseract-script-%{pkgname}-best\ Summary: %{scriptname} script data for %{name}\ BuildArch: noarch\ Requires: tesseract\ Requires: %{name}-doc = %{version}-%{release}\ \ %description -n tesseract-script-%{pkgname}-best\ This package contains the best (most accurate) floating-point version of \ the %{scriptname} script \ trained model for the Tesseract Open Source OCR Engine.\ \ This model only work with the LSTM OCR engine of Tesseract 4 and above.\ To use these models instead of the default tessdata_fast, export \ TESSDATA_PREFIX=/usr/share/tesseract/tessdata_best/\ \ %files -n tesseract-script-%{pkgname}-best\ %dir %{_datadir}/tesseract/tessdata_best/script/\ %{_datadir}/tesseract/tessdata_best/script/%{filename}.* # see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes # and https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes %lang_subpkg -m afr -l af -n Afrikaans %lang_subpkg -m amh -l an -n Amharic %lang_subpkg -m ara -l ar -n Arabic %lang_subpkg -m asm -l as -n Assamese %lang_subpkg -m aze -l az -n Azerbaijani %lang_subpkg -m aze_cyrl -n %{quote:Azerbaijani (Cyrillic)} %lang_subpkg -m bel -l bel -n Belarusian %lang_subpkg -m ben -l bn -n Bengali %lang_subpkg -m bod -l bo -n %{quote:Tibetan (Standard)} %lang_subpkg -m bos -l bs -n Bosnian %lang_subpkg -m bre -l br -n Breton %lang_subpkg -m bul -l bg -n Bulgarian %lang_subpkg -m cat -l ca -n Catalan %lang_subpkg -m ceb -n Cebuano %lang_subpkg -m ces -l cs -n Czech %lang_subpkg -m chi_sim -l zh_CN -n %{quote:Chinese (Simplified)} %lang_subpkg -m chi_sim_vert -l zh_CN -n %{quote:Chinese (Simplified, Vertical)} %lang_subpkg -m chi_tra -l zh_TW -n %{quote:Chinese (Traditional)} %lang_subpkg -m chi_tra_vert -l zh_TW -n %{quote:Chinese (Traditional, Vertical)} %lang_subpkg -m chr -n Cherokee %lang_subpkg -m cos -l co -n Corsican %lang_subpkg -m cym -l cy -n Welsh %lang_subpkg -m dan -l da -n Danish %lang_subpkg -m deu -l de -n German %lang_subpkg -m div -l dv -n %{quote:Dhivehi; Maldivian} %lang_subpkg -m dzo -n Dzongkha %lang_subpkg -m ell -l el -n Greek %lang_subpkg -m eng -n English %lang_subpkg -m enm -n %{quote:Middle English (1100-1500)} %lang_subpkg -m epo -l eo -n Esperanto %lang_subpkg -m est -l et -n Estonian %lang_subpkg -m eus -l eu -n Basque %lang_subpkg -m fao -l fo -n %{quote:Faroese} %lang_subpkg -m fas -l fa -n %{quote:Persian (Farsi)} %lang_subpkg -m fil -n %{quote:Filipino; Pilipino} %lang_subpkg -m fin -l fi -n Finnish %lang_subpkg -m fra -l fr -n French %lang_subpkg -m frk -n Fraktur %lang_subpkg -m frm -n %{quote:Middle French (ca. 1400-1600)} %lang_subpkg -m fry -l fy -n %{quote:Western Frisian} %lang_subpkg -m gla -l gd -n %{quote:Gaelic; Scottish Gaelic} %lang_subpkg -m gle -l ga -n Irish %lang_subpkg -m glg -l gl -n Galician %lang_subpkg -m grc -n %{quote:Ancient Greek} %lang_subpkg -m guj -l gu -n Gujarati %lang_subpkg -m hat -l ht -n Haitian %lang_subpkg -m heb -l he -n Hebrew %lang_subpkg -m hin -l hi -n Hindi %lang_subpkg -m hrv -l hr -n Croatian %lang_subpkg -m hun -l hu -n Hungarian %lang_subpkg -m hye -l hy -n Armenian %lang_subpkg -m iku -l iu -n Inuktitut %lang_subpkg -m ind -l id -n Indonesian %lang_subpkg -m isl -l is -n Icelandic %lang_subpkg -m ita -l it -n Italian %lang_subpkg -m ita_old -n %{quote:Italian (Old)} %lang_subpkg -m jav -l jav -n Javanese %lang_subpkg -m jpn -l ja -n Japanese %lang_subpkg -m jpn_vert -l ja -n "Japanese (Vertical)" %lang_subpkg -m kan -l kn -n Kannada %lang_subpkg -m kat -l ka -n Georgian %lang_subpkg -m kat_old -n %{quote:Georgian (Old)} %lang_subpkg -m kaz -l kk -n Kazakh %lang_subpkg -m khm -l km -n Khmer %lang_subpkg -m kir -l ky -n Kyrgyz %lang_subpkg -m kor -l ko -n Korean %lang_subpkg -m kor_vert -l ko -n "Korean (Vertical)" %lang_subpkg -m kmr -l ku -n Kurmanji %lang_subpkg -m lao -l lo -n Lao %lang_subpkg -m lat -l lat -n Latin %lang_subpkg -m lav -l lv -n Latvian %lang_subpkg -m lit -l lt -n Lithuanian %lang_subpkg -m ltz -l lb -n Luxembourgish %lang_subpkg -m mal -l ml -n Malayalam %lang_subpkg -m mar -l mr -n Marathi %lang_subpkg -m mkd -l mk -n Macedonian %lang_subpkg -m mlt -l mt -n Maltese %lang_subpkg -m mon -l mn -n Mongolian %lang_subpkg -m mri -l mi -n Maori %lang_subpkg -m msa -l ms -n Malay %lang_subpkg -m mya -l my -n Burmese %lang_subpkg -m nep -l ne -n Nepali %lang_subpkg -m nld -l nl -n Dutch %lang_subpkg -m nor -l no -n Norwegian %lang_subpkg -m oci -l oc -n Occitan %lang_subpkg -m ori -l or -n Oriya %lang_subpkg -m pan -l pa -n Panjabi %lang_subpkg -m pol -l pl -n Polish %lang_subpkg -m por -l pt -n Portuguese %lang_subpkg -m pus -l ps -n Pashto %lang_subpkg -m que -l qu -n Quechuan %lang_subpkg -m ron -l ro -n Romanian %lang_subpkg -m rus -l ru -n Russian %lang_subpkg -m san -l sa -n Sanskrit %lang_subpkg -m sin -l si -n Sinhala %lang_subpkg -m slk -l sk -n Slovakian %lang_subpkg -m slv -l sl -n Slovenian %lang_subpkg -m snd -l sd -n Sindhi %lang_subpkg -m spa -l es -n Spanish %lang_subpkg -m spa_old -n %{quote:Spanish (Old)} %lang_subpkg -m sqi -l sq -n Albanian %lang_subpkg -m srp -l sr -n Serbian %lang_subpkg -m srp_latn -n %{quote:Serbian (Latin)} %lang_subpkg -m sun -l su -n Sundanese %lang_subpkg -m swa -l sw -n Swahili %lang_subpkg -m swe -l sv -n Swedish %lang_subpkg -m syr -l ar_SY -n Syriac %lang_subpkg -m tam -l ta -n Tamil %lang_subpkg -m tat -l tt -n Tatar %lang_subpkg -m tel -l te -n Telugu %lang_subpkg -m tgk -l tg -n Tajik %lang_subpkg -m tha -l th -n Thai %lang_subpkg -m tir -l ti -n Tigrinya %lang_subpkg -m ton -l to -n Tongan %lang_subpkg -m tur -l tr -n Turkish %lang_subpkg -m uig -l ug -n Uyghur %lang_subpkg -m ukr -l uk -n Ukrainian %lang_subpkg -m urd -l ur -n Urdu %lang_subpkg -m uzb -l uz -n Uzbek %lang_subpkg -m uzb_cyrl -n %{quote:Uzbek (Cyrillic)} %lang_subpkg -m vie -l vi -n Vietnamese %lang_subpkg -m yid -l yi -n Yiddish %lang_subpkg -m yor -l yo -n Yoruba %script_subpkg -n Arabic -s Arabic %script_subpkg -n Armenian -s Armenian %script_subpkg -n Bengali -s Bengali %script_subpkg -n Canadian_Aboriginal -s %{quote:Canadian (Aboriginal)} %script_subpkg -n Cherokee -s Cherokee %script_subpkg -n Cyrillic -s Cyrillic %script_subpkg -n Devanagari -s Devanagari %script_subpkg -n Ethiopic -s Ethiopic %script_subpkg -n Fraktur -s Fraktur %script_subpkg -n Georgian -s Georgian %script_subpkg -n Greek -s Greek %script_subpkg -n Gujarati -s Gujarati %script_subpkg -n Gurmukhi -s Gurmukhi %script_subpkg -n HanS -s %{quote:Han (Simplified)} %script_subpkg -n HanS_vert -s %{quote:Han (Simplified, Vertical)} %script_subpkg -n HanT -s %{quote:Han (Traditional)} %script_subpkg -n HanT_vert -s %{quote:Han (Traditional, Vertical)} %script_subpkg -n Hangul -s Hangul %script_subpkg -n Hangul_vert -s %{quote:Hangul (Vertical)} %script_subpkg -n Hebrew -s Hebrew %script_subpkg -n Japanese -s Japanese %script_subpkg -n Japanese_vert -s %{quote:Japanese (Vertical)} %script_subpkg -n Kannada -s Kannada %script_subpkg -n Khmer -s Khmer %script_subpkg -n Lao -s Lao %script_subpkg -n Latin -s Latin %script_subpkg -n Malayalam -s Malayalam %script_subpkg -n Myanmar -s Myanmar %script_subpkg -n Oriya -s Oriya %script_subpkg -n Sinhala -s Sinhala %script_subpkg -n Syriac -s Syriac %script_subpkg -n Tamil -s Tamil %script_subpkg -n Telugu -s Telugu %script_subpkg -n Thaana -s Thaana %script_subpkg -n Thai -s Thai %script_subpkg -n Tibetan -s Tibetan %script_subpkg -n Vietnamese -s Vietnamese %prep %if 0%{?commit:1} %autosetup -p1 -n tessdata_best-%{commit} %else %autosetup -p1 -n tessdata_best-%{version}%{?pre:-%pre} %endif %build # Nothing to build %install mkdir -p %{buildroot}/%{_datadir}/tesseract/tessdata_best/ cp -a * %{buildroot}/%{_datadir}/tesseract/tessdata_best/ # _best doesn't include equ.traineddata (well, it does but it is just a copy # from _fast) so don't bother packaging it. If it's needed, a symlink could be # used like so: #ln -s %{_datadir}/tesseract/tessdata/equ.traineddata %{_datadir}/tesseract/tessdata_best/equ.traineddata # Install these through %%license and %%doc rm -f %{buildroot}/%{_datadir}/tesseract/tessdata_best/LICENSE rm -f %{buildroot}/%{_datadir}/tesseract/tessdata_best/README.md # https://github.com/tesseract-ocr/tessdata_fast/issues/27 rm -f %{buildroot}/%{_datadir}/tesseract/tessdata_best/configs rm -f %{buildroot}/%{_datadir}/tesseract/tessdata_best/pdf.ttf %files doc %license LICENSE %doc README.md %files osd %{_datadir}/tesseract/tessdata_best/osd.traineddata %changelog * Mon Dec 9 2024 Peter Simonyi - 4.1.0-1 - Initial package split from tesseract-tessdata