Metadata-Version: 2.4
Name: jusText
Version: 4.0.0
Summary: Heuristic based boilerplate removal tool
Author: Jan Pomikálek
Author-email: Jan Pomikálek <jan.pomikalek@gmail.com>
License-Expression: BSD-2-Clause
License-File: LICENSE.rst
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Pre-processors
Classifier: Topic :: Text Processing :: Filters
Classifier: Topic :: Text Processing :: Markup :: HTML
Requires-Dist: lxml[html-clean]>=4.4.2
Maintainer: Michal Belica
Maintainer-email: Michal Belica <miso.belica@gmail.com>
Requires-Python: >=3.8
Project-URL: Homepage, https://github.com/miso-belica/jusText
Project-URL: Repository, https://github.com/miso-belica/jusText
Description-Content-Type: text/markdown

# jusText

[![Run tests](https://github.com/miso-belica/jusText/actions/workflows/run-tests.yml/badge.svg)](https://github.com/miso-belica/jusText/actions/workflows/run-tests.yml)

Program jusText is a tool for removing boilerplate content, such as navigation
links, headers, and footers from HTML pages. It is
[designed](doc/algorithm.rst) to preserve
mainly text containing full sentences and it is therefore well suited for
creating linguistic resources such as Web corpora. You can
[try it online](http://nlp.fi.muni.cz/projects/justext/).

This is a fork of original (currently unmaintained) code of [jusText](http://code.google.com/p/justext/) hosted
on Google Code.

Adaptations of the algorithm to other languages:

- [C++](https://github.com/endredy/jusText)
- [Go](https://github.com/JalfResi/justext)
- [Java](https://github.com/wizenoze/justext-java)
- [Javascript](https://github.com/smodin-io/justext)

Some libraries using jusText:

- [chirp](https://github.com/9b/chirp)
- [lazynlp](https://github.com/chiphuyen/lazynlp)
- [off-topic-memento-toolkit](https://github.com/oduwsdl/off-topic-memento-toolkit)
- [pears](https://github.com/PeARSearch/PeARS-orchard)
- [readability calculator](https://github.com/joaopalotti/readability_calculator)
- [sky](https://github.com/kootenpv/sky)

Some currently (Jan 2020) maintained alternatives:

- [dragnet](https://github.com/dragnet-org/dragnet)
- [html2text](https://github.com/Alir3z4/html2text)
- [inscriptis](https://github.com/weblyzard/inscriptis)
- [newspaper](https://github.com/codelucas/newspaper)
- [python-readability](https://github.com/buriy/python-readability)
- [trafilatura](https://github.com/adbar/trafilatura)

## Installation

Make sure you have [Python](http://www.python.org/) 3.8+ and [pip](https://pip.pypa.io/en/stable/)
([Windows](http://docs.python-guide.org/en/latest/starting/install/win/),
[Linux](http://docs.python-guide.org/en/latest/starting/install/linux/)) installed.
Run simply:

```bash
$ pip install justext
```

## Dependencies

```
lxml (version depends on your Python version)
```

## Usage

```bash
$ python -m justext -s Czech -o text.txt http://www.zdrojak.cz/clanky/automaticke-zabezpeceni/
$ python -m justext -s English -o plain_text.txt english_page.html
$ python -m justext --help # for more info
```

## Python API

```python
import requests
import justext

response = requests.get("http://planet.python.org/")
paragraphs = justext.justext(response.content, justext.get_stoplist("English"))
for paragraph in paragraphs:
    if not paragraph.is_boilerplate:
        print(paragraph.text)
```

## Development

Install [uv](https://docs.astral.sh/uv/) and run tests and the linter via

```bash
$ uv run pytest
$ uv run ruff check
```

## Acknowledgements

This software has been developed at the [Natural Language Processing Centre](http://nlp.fi.muni.cz/en/nlpc) of
[Masaryk University in Brno](http://nlp.fi.muni.cz/en) with a financial support from [PRESEMT](http://presemt.eu/) and
[Lexical Computing Ltd.](http://lexicalcomputing.com/) It also relates to [PhD research](http://is.muni.cz/th/45523/fi_d/phdthesis.pdf) of Jan Pomikálek.
