chiuta.ro

Programe native: demonstrații în terminal

Sesiuni reale de terminal, rulate pe date demo mici, cu subtitrări în 8 limbi și voce sintetică opțională. Fără sunet implicit, fără urmărire, găzduite aici.

Traducerile în fr, it, es, pt, de și hu sunt automate și așteaptă revizuirea unor vorbitori nativi.

LegatorOCR legatorocr 0.2.0-pre.10

Pagini scanate în PDF cu text: corectare, OCR, export

Pagina are nevoie de JavaScript pentru redare; transcrierea de mai jos funcționează fără.

Transcriere
  1. LegatorOCR transformă pagini scanate într-un PDF cu text. Aici sunt trei imagini cu text ușor înclinat.

    • $ ls -l page-*.png
      -rw-r--r-- 1 root root 179783 Nov  3 14:20 page-1.png
      -rw-r--r-- 1 root root 175232 Nov  3 14:20 page-2.png
      -rw-r--r-- 1 root root 187296 Nov  3 14:20 page-3.png
      
  2. O singură comandă corectează înclinarea, recunoaște textul cu OCR și scrie PDF-ul și un fișier text. Tabelul de timpuri arată unde se duce timpul.

    • $ legatorocr page-*.png --format none --pdf book.pdf --ocr --lang en --txt book.txt --timings
      OCR engine: tesseract 5.3.4, language: en
      page-1: 788x1491 px @ 150 dpi, skew +2.33°
      page-2: 789x1491 px @ 150 dpi, skew -1.65°
      page-3: 788x1491 px @ 150 dpi, skew +3.10°
      stage                  calls     time (s)   share   per call (ms)
      ocr                          3         5.84   65.6%         1946.2
      clean-up                     3         3.02   34.0%         1007.5
        deskew/rotate              3         1.04   11.7%          345.8
        deskew/pictures            3         0.26    2.9%           87.3
        deskew/detect              3         0.24    2.7%           79.7
        content/analyse            3         0.18    2.1%           61.3
        deskew/analyse             3         0.17    1.9%           55.8
        content/detect             3         0.04    0.5%           14.5
      load                         3         0.04    0.5%           13.4
        content/grayscale          3         0.01    0.2%            4.8
        deskew/grayscale           3         0.01    0.2%            4.8
        clean-up/background        3         0.01    0.1%            2.5
      orientation                  3         0.00    0.0%            0.0
      total (summed over threads): 8.90 s
      peak memory: 203 MiB
      wrote book.pdf (3 page(s), 155 OCR words)
      wrote book.txt
      
  3. Textul recunoscut, pagină cu pagină. Imaginile din demonstrație sunt generate, deci rezultatul e curat; scanările reale sunt mai grele.

    • $ ls -l book.pdf book.txt
      -rw-r--r-- 1 root root 242042 Nov  3 14:20 book.pdf
      -rw-r--r-- 1 root root    839 Nov  3 14:20 book.txt
      
    • $ head -n 8 book.txt
      Chapter 1. The Beginnings
      The library was founded in 1864 by a
      group of teachers and merchants. In the
      first years the books were kept in a single
      room, and lending was recorded in a ledger.
      By the end of the century the collection
      held over ten thousand volumes, mostly gifts.
      Chapter 2. The Beginnings
      
  4. PDF-ul are strat de text: poate fi căutat și copiat. Programul rulează local, fără cont.

    • $ pdftotext book.pdf - | head -n 3
      Chapter 1. The Beginnings
      The library was founded in 1864 by a
      group of teachers and merchants. In the
      

Vocea este sintetizată local cu espeak-ng (GPL-3.0); sună mecanic, dar funcționează în toate cele 8 limbi.

Ritmul este montat pentru a putea fi urmărit; textul de pe ecran este ieșirea reală a programelor, iar căile absolute sunt scurtate la /home/demo.