![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
layouts-segmentation-simplifier
Advanced tools
pip install https://github.com/PonteIneptique/lss/archive/refs/heads/main.zip
or
pip install layouts-segmentation-simplifier
from lss.parsers import PageXML
file = PageXML.from_file(
# Path to your file
"data/0002_Main_frame.xml",
# Optional: set-up the namespace, as they tend to change a lot
namespace="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"
)
# Simplify your baseline: things within 10% of your line height will be discarded (Seems to be a good number)
file.simplify_lines(ratio=.10)
# Simplify your baseline: things within 15% of your mask height will be discarded (Seems to be a good number)
file.simplify_masks(ratio=.15)
# You can retrieve the xml in file.xml or dump the modified xml in file.xml
file.dump(filepath="file.xml")
You can also get it to make multiple simulation, to chose the best value (highest ratio = bigger simplification)
from lss.parsers import PageXML
page = PageXML.from_file("./data/0002_Main_frame.xml")
page.find_namespace() # Useful in case you use PageXML as it scans for the right namespace
page.test_values(
[(.05, .05), (.1, .1), (.15, .15), (.20, .20)],
image="./data/0002_Main_frame.jpg",
basename_output="./data/0002_Main_frame"
)
In this context, lines will be simplified by a ratio of 0.05, 0.10, 0.15 and 0.20. Mask will be as well. Few files will be saved. Each test will create test files with overlays (cf. folder data for all examples):
Original | 15% ratio on both line and masks |
---|---|
![]() | ![]() |
10% | 20% |
---|---|
![]() | ![]() |
FAQs
Layout Segmentation Simplifier
We found that layouts-segmentation-simplifier demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.