Python client for Parsr - Transforms PDF, Documents and Images into Enriched Structured Data
Project description
Parsr Client
Provides a python interface to the Parsr tool via its API. Parsr transforms PDF, documents and images into enriched, structured data.
Find out all about Parsr (including download) at http://par.sr.
1 Installation
pip install parsr
2 Usage
Make sure that the Parsr Server is already running. Let us suppose that the address is localhost:3001
2.1 Connect to the Parsr server
from parsr_client import ParsrClient
parsr = ParsrClient('localhost:3001')
2.2 Send the document
parsr.send_document(
file_path='README.pdf',
config_path='defaultConfig.json'
document_name='The Readme')
2.4 Retrieve results
-
Get everything as a JSON:
parsr.get_json()
-
As Markdown:
parsr.get_markdown()
-
As text:
parsr.get_text()
-
Get the first table on the first page:
parsr.get_table( page=1, table=1, )
-
Get all the versions of the document:
parsr.get_revisions('The Readme')
-
Get pretty diffs between each successive pair of a document's revisions:
parsr.compare_revisions('The Readme', pretty_html=True)
3 Interpreting the whole JSON output locally
The supplied ParsrOutputInterpreter
class can be used to interpret the downloaded JSON output and generate higher level structures like the text body.
Here's an example to generate text body on the first page from the above example.
from parsr_client import ParsrOutputInterpreter
parsr_interpreter = ParsrOutputInterpreter(
parsr.get_json()
)
t = parsr_interpreter.get_text(
page_number=1
)
print(t)
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
Hashes for parsr_client-3.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37322e5a52faf0c8cd0c9f696ec522e7851875ace1c616932ea2e7da34947b7c |
|
MD5 | 5879fd0b6488f0dfab7dfe57226e9b0e |
|
BLAKE2b-256 | 877ecda32ea9606e67092484988536c0a79d06d6e33afe64939a0b7b2f9bee29 |