Extracting content from spesific address books
Project description
historical-text-extraction (hte)
Package to extract text from historical documents. The package is written for personal use.
Installation
The current release from the PyPI repository:
pip install hte
The development version from GitHub with:
pip install git+ssh://git@github.com/eirikberger/hte.git
Note that it is nessecary with a SSH key for this approach to work.
Using it
Import the package
from hte import digitize
The basic setup is the following:
# Define class
book = digitize.Book("data/finnmark_1968.pdf", "books")
# Run methods on the class
book.CreateFolderStructure()
book.PdfImport(page_info=False, from_page=21, to_page=263)
book.Split(multiple_columns=True)
book.RunOCR(type="splits", export_image=False)
book.CombineCleanGroup(ocr_grouping=True, group_type='norway')
book.RegexStructure("norway")
Make sure to install the correct language package for Tesseract.
# Check languages already installed:
tesseract --list-langs
# Languages available for installation
apt-cache search tesseract-ocr
# Install the Norwegian language pack
sudo apt-get install tesseract-ocr-nor
Extracting headers
Start by converting xml files to json. These files can be created by using the free software labelImg
.
import os
os.chdir('/home/eirikb/Desktop')
header = Headers('train', 2022)
header.runbbxConverting()
Then convert the json file to csv.
convertFromJson('/home/eirikb/Desktop/training_xml/json-bbox', 'xml')
Finally, read the concent of the boxes.
ReadBoxes('json-bbox/xml.csv', 'hordaland', 'train', print_images=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hte-0.0.23.tar.gz
.
File metadata
- Download URL: hte-0.0.23.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57c50b74f2db83e25e79334b8b81c44a40f773caa3aafeb2e79631efe88bc793 |
|
MD5 | b809922f313837dfd6f089f025524fbf |
|
BLAKE2b-256 | 94e6695f77df54d54d37d6ceb10eabd071f263b9563d2df5141823107c929d65 |
File details
Details for the file hte-0.0.23-py3-none-any.whl
.
File metadata
- Download URL: hte-0.0.23-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 038cfd6a6740a21645029d25691696c7814552d47a37f2cf98c001bcf9d70c40 |
|
MD5 | e50fcbb34a159a2bd08ba8501e2ba4b0 |
|
BLAKE2b-256 | 8aab04a98d5fc77391d1208653dcb96b1cd51d96a242226144a335aaa4f050a2 |