ScienceBeam Parser Python Library
ScienceBeam Parser allows you to parse scientific documents. It provides a REST API Service, as well as a Python API.
Installation
pip install sciencebeam-parser[delft,cpu]
CLI
CLI: Start Server
python -m sciencebeam_parser.service.server --port=8080
The server will start to listen on port 8080.
The default config.yml defines what models to load.
You can find the API docs under /api/docs, e.g.:
http://localhost:8080/api/docs
Python API
Python API: Start Server
from sciencebeam_parser.config.config import AppConfig
from sciencebeam_parser.resources.default_config import DEFAULT_CONFIG_FILE
from sciencebeam_parser.service.server import create_app
config = AppConfig.load_yaml(DEFAULT_CONFIG_FILE)
app = create_app(config)
app.run(port=8080, host='127.0.0.1', threaded=True)
The server will start to listen on port 8080.
Python API: Parse Multiple Files
from sciencebeam_parser.resources.default_config import DEFAULT_CONFIG_FILE
from sciencebeam_parser.config.config import AppConfig
from sciencebeam_parser.utils.media_types import MediaTypes
from sciencebeam_parser.app.parser import ScienceBeamParser
config = AppConfig.load_yaml(DEFAULT_CONFIG_FILE)
# the parser contains all of the models
sciencebeam_parser = ScienceBeamParser.from_config(config)
# a session provides a scope and temporary directory for intermediate files
# it is recommended to create a separate session for every document
with sciencebeam_parser.get_new_session() as session:
session_source = session.get_source(
'test-data/minimal-example.pdf',
MediaTypes.PDF
)
converted_file = session_source.get_local_file_for_response_media_type(
MediaTypes.TEI_XML
)
# Note: the converted file will be in the temporary directory of the session
print('converted file:', converted_file)
More Usage Examples
For more usage examples see sciencebeam-usage-examples.
Metadata
Release files for sciencebeam-parser 0.1.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sciencebeam_parser-0.1.18.tar.gz | 114.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sciencebeam_parser-0.1.18-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 280.4 kB
Release files / sciencebeam_parser-0.1.18.tar.gz
| Download URL | sciencebeam_parser-0.1.18.tar.gz |
|---|---|
| Size | 114.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7156139ab9075859b778b38a2550b5cb88e4230edcf352f7b72f86b5854563de
|
|
BLAKE2b-256 checksum How to use checksums |
84f1df2b45b169b49ab340829ff6381c96464507c205786dfc2a664b0ac2015a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / sciencebeam_parser-0.1.18-py3-none-any.whl
| Download URL | sciencebeam_parser-0.1.18-py3-none-any.whl |
|---|---|
| Size | 165.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d6eeaed542465805fdea8e97d95654e73be6de09018ee21bd4d4917c9b9d399
|
|
BLAKE2b-256 checksum How to use checksums |
8b8d61b4a379cf63229ac59e2120fc3c6011b62e8b4640a8ec85704514de89d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|