Skip to main content

Heuristic based boilerplate removal tool

Project description

jusText

https://api.travis-ci.org/miso-belica/jusText.png?branch=master

Program jusText is a tool for removing boilerplate content, such as navigation links, headers, and footers from HTML pages. It is designed 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.

This is a fork of original (currently unmaintained) code of jusText hosted on Google Code. Below are some alternatives that I found:

Installation

Make sure you have Python 2.6+/3.2+ and pip (Windows, Linux) installed. Run simply (preferred way):

$ [sudo] pip install git+git://github.com/miso-belica/jusText.git

Or if you have to:

$ wget https://github.com/miso-belica/jusText/archive/master.zip # download the sources
$ unzip master.zip # extract the downloaded file
$ jusText-master/
$ [sudo] python setup.py install # install the package

Dependencies

lxml>=2.2.4

Usage

$ 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

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

Testing

Run tests via

$ nosetests tests

Acknowledgements

This software is developed at the Natural Language Processing Centre of Masaryk University in Brno with a financial support from PRESEMT and Lexical Computing Ltd. It also relates to PhD research of Jan Pomikálek.

Changelog for jusText

2.0.0 (2013-08-26)

  • FEATURE: Added pluggable DOM preprocessor.

  • FEATURE: Added support for Python 3.2+.

  • INCOMPATIBLE CHANGE: Paragraphs are instances of justext.paragraph.Paragraph.

  • INCOMPATIBLE CHANGE: Script ‘justext’ removed in favour of command python -m justext.

  • FEATURE: It’s possible to enter an URI as input document in CLI.

  • FEATURE: It is possible to pass unicode string directly.

1.2.0 (2011-08-08)

  • FEATURE: Character counts used instead of word counts where possible in order to make the algorithm work well in the language independent mode (without a stoplist) for languages where counting words is not easy (Japanese, Chinese, Thai, etc).

  • BUG FIX: More robust parsing of meta tags containing the information about used charset.

  • BUG FIX: Corrected decoding of HTML entities € to Ÿ

1.1.0 (2011-03-09)

  • First public release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jusText-2.0.0.zip (864.3 kB view details)

Uploaded Source

File details

Details for the file jusText-2.0.0.zip.

File metadata

  • Download URL: jusText-2.0.0.zip
  • Upload date:
  • Size: 864.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jusText-2.0.0.zip
Algorithm Hash digest
SHA256 c132eea09cebfe8e0f74f2c8c5e7f74ec948b17774244613ee44d0d01033333f
MD5 b2e2e8287eb6bc0b2999e659618130b6
BLAKE2b-256 c8e0b2cb91cab1661de64fd8aa464615b0a24dd6b40e4ff7894c3bf69f0ef951

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page