COMBINE_TESSDATA(1)

πŸ’… combine_tessdata, bestie (that's the COMBINE_TESSDATA(1) manual, and yes she's iconic)

okay so real talk β€” this is the COMBINE_TESSDATA(1) page and honestly? it's giving main character energy for anyone who's ever wrestled a Tesseract file. let's get into it 🫢


✨ NAME ✨

combine_tessdata β€” combine/extract/overwrite/list/compact Tesseract data

like, she does everything to your tessdata, no cap πŸ’–


✨ SYNOPSIS ✨

combine_tessdata [OPTION] FILE...

🌸 DESCRIPTION 🌸

combine_tessdata(1) is the main program to combine/extract/overwrite/list/compact tessdata components in [lang].traineddata files. she's the momager of tessdata files, periodt.

so say you've got all your individual tessdata components (unicharset, DAWGs, classifier templates, ambiguities, language configs) sitting in, like, /home/$USER/temp/eng.* β€” you just run:

combine_tessdata /home/$USER/temp/eng.

and boom πŸ’₯ the result will be a combined tessdata file:

/home/$USER/temp/eng.traineddata

gorgeous. no notes.


now. if you want to extract individual components out of a combined traineddata file, you specify option -e. literally so easy. for example, to extract the language config file and the unicharset from tessdata/eng.traineddata, run:

combine_tessdata -e tessdata/eng.traineddata \
  /home/$USER/temp/eng.config /home/$USER/temp/eng.unicharset

the desired config file and unicharset will be written to /home/$USER/temp/eng.config and /home/$USER/temp/eng.unicharset ✨


want to overwrite individual components of the given [lang].traineddata file? specify option -o, bestie. for example, to overwrite language config and unichar ambiguities files in tessdata/eng.traineddata, use:

combine_tessdata -o tessdata/eng.traineddata \
  /home/$USER/temp/eng.config /home/$USER/temp/eng.unicharambigs

as a result, tessdata/eng.traineddata will contain the new language config and unichar ambigs, plus all the original DAWGs, classifier templates, etc. she keeps her whole personality and just gets a little upgrade πŸ’…

⚠️ note (and this one's important, don't skip her): the file names of the files to extract to and to overwrite from should have the appropriate file suffixes (extensions) indicating their tessdata component type (.unicharset for the unicharset, .unicharambigs for unichar ambigs, etc). see k*FileSuffix variable in ccutil/tessdatamanager.h.

and if you specify option -u, she unpacks all the components to the specified path:

combine_tessdata -u tessdata/eng.traineddata /home/$USER/temp/eng.

this will create /home/$USER/temp/eng.* files with individual tessdata components from tessdata/eng.traineddata. iykyk πŸ¦‹


πŸ”₯ OPTIONS πŸ”₯

  • -c .traineddata FILE... β€” compacts the LSTM component in the .traineddata file to int. tiny queen, smaller file πŸŽ€
  • -d .traineddata FILE... β€” lists directory of components from the .traineddata file. a little tour of what's inside πŸ‘‘
  • -e .traineddata FILE... β€” extracts the specified components from the .traineddata file. free her children 😭
  • -l .traineddata FILE... β€” list the network information. the tea on the neural net β˜•
  • -o .traineddata FILE... β€” overwrites the specified components of the .traineddata file with those provided on the command line. glow-up time ✨
  • -u .traineddata PATHPREFIX β€” unpacks the .traineddata using the provided prefix. everything out in the open 🌈

πŸ’€ CAVEATS πŸ’€

prefix refers to the full file prefix, including period (.)

like, the . is not optional, she is part of the name, respect her or she will not work. don't embarrass yourself fr fr πŸ™ˆ


🧚 COMPONENTS 🧚

the components in a Tesseract lang.traineddata file as of Tesseract 4.0 are briefly described below; for more information on many of these files, see https://tesseract-ocr.github.io/tessdoc/Training-Tesseract.html and https://tesseract-ocr.github.io/tessdoc/TrainingTesseract-4.00.html

okay lineup time, going down the list one by one ⭐

  • lang.config β€” (Optional) language-specific overrides to default config variables. for 4.0 traineddata files, lang.config provides control parameters which can affect layout analysis, and sub-languages. she's the vibe-setter πŸ’œ
  • lang.unicharset β€” (Required - 3.0x legacy tesseract) the list of symbols that Tesseract recognizes, with properties. see unicharset(5). required, so like… don't forget her πŸŽ€
  • lang.unicharambigs β€” (Optional - 3.0x legacy tesseract) this file contains information on pairs of recognized symbols which are often confused. for example, rn and m. relatable honestly 😭
  • lang.inttemp β€” (Required - 3.0x legacy tesseract) character shape templates for each unichar. produced by mftraining(1). the original fit check πŸ’…
  • lang.pffmtable β€” (Required - 3.0x legacy tesseract) the number of features expected for each unichar. produced by mftraining(1) from .tr files.
  • lang.normproto β€” (Required - 3.0x legacy tesseract) character normalization prototypes generated by cntraining(1) from .tr files.
  • lang.punc-dawg β€” (Optional - 3.0x legacy tesseract) a dawg made from punctuation patterns found around words. the "word" part is replaced by a single space. (yes she is literally a dawg, we love her) 🐢
  • lang.word-dawg β€” (Optional - 3.0x legacy tesseract) a dawg made from dictionary words from the language.
  • lang.number-dawg β€” (Optional - 3.0x legacy tesseract) a dawg made from tokens which originally contained digits. each digit is replaced by a space character.
  • lang.freq-dawg β€” (Optional - 3.0x legacy tesseract) a dawg made from the most frequent words which would have gone into word-dawg. the popular girls only πŸ’–
  • lang.fixed-length-dawgs β€” (Optional - 3.0x legacy tesseract) several dawgs of different fixed lengths β€” useful for languages like Chinese.
  • lang.shapetable β€” (Optional - 3.0x legacy tesseract) when present, a shapetable is an extra layer between the character classifier and the word recognizer that allows the character classifier to return a collection of unichar ids and fonts instead of a single unichar-id and font. extra layer = extra slay 🌸
  • lang.bigram-dawg β€” (Optional - 3.0x legacy tesseract) a dawg of word bigrams where the words are separated by a space and each digit is replaced by a ?.
  • lang.unambig-dawg β€” (Optional - 3.0x legacy tesseract) . (yes that's all the original says, she's mysterious 🀫)
  • lang.params-model β€” (Optional - 3.0x legacy tesseract) . (again, mysterious, we respect it)
  • lang.lstm β€” (Required - 4.0 LSTM) neural net trained recognition model generated by lstmtraining. the actual brain cell πŸ”₯
  • lang.lstm-punc-dawg β€” (Optional - 4.0 LSTM) a dawg made from punctuation patterns found around words. the "word" part is replaced by a single space. uses lang.lstm-unicharset.
  • lang.lstm-word-dawg β€” (Optional - 4.0 LSTM) a dawg made from dictionary words from the language. uses lang.lstm-unicharset.
  • lang.lstm-number-dawg β€” (Optional - 4.0 LSTM) a dawg made from tokens which originally contained digits. each digit is replaced by a space character. uses lang.lstm-unicharset.
  • lang.lstm-unicharset β€” (Required - 4.0 LSTM) the unicode character set that Tesseract recognizes, with properties. same unicharset must be used to train the LSTM and build the lstm-*-dawgs files. matching sets or it's a no 🫢
  • lang.lstm-recoder β€” (Required - 4.0 LSTM) Unicharcompress, aka the recoder, which maps the unicharset further to the codes actually used by the neural network recognizer. this is created as part of the starter traineddata by combine_lang_model. she's the translator bestie 🌟
  • lang.version β€” (Optional) version string for the traineddata file. first appeared in version 4.0 of Tesseract. old version of traineddata files will report Version:Pre-4.0.0. 4.0 version of traineddata files may include the network spec used for LSTM training as part of version string. the receipts 🧾

πŸ‘‘ HISTORY πŸ‘‘

combine_tessdata(1) first appeared in version 3.00 of Tesseract. a legacy icon, we stan ⭐


🌈 SEE ALSO 🌈

tesseract(1), wordlist2dawg(1), cntraining(1), mftraining(1), unicharset(5), unicharambigs(5)

the whole friend group, go say hi πŸ’–


πŸ“ COPYING πŸ“

copyright (C) 2009, Google Inc. licensed under the Apache License, Version 2.0. legal queen, respect the license πŸ™


πŸ’œ AUTHOR πŸ’œ

the Tesseract OCR engine was written by Ray Smith and his research groups at Hewlett Packard (1985-1995) and Google (2006-2018). absolute legends, no cap πŸ‘‘


and that's the whole page bestie πŸ’… this was the COMBINE_TESSDATA(1) manual, dated 2026-09-28 β€” go forth and combine/extract/overwrite/list/compact responsibly, mwah πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from