misja/python-boilerpipe
소개
HTML 페이지에서 보일러플레이트를 제거하고 전체 텍스트를 추출하는 Boilerpipe용 Python 인터페이스
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalpython-boilerpipe
A python wrapper for Boilerpipe, an excellent Java library for boilerplate removal and fulltext extraction from HTML pages.
Configuration
Dependencies:
- jpype
- chardet
The boilerpipe jar files will get fetched and included automatically when building the package.
Installation
Checkout the code:
git clone https://github.com/misja/python-boilerpipe.git
cd python-boilerpipe
virtualenv
virtualenv env
source env/bin/activate
pip install -r requirements.txt
python setup.py install
Fedora
sudo dnf install -y python2-jpype
sudo python setup.py install
Usage
Be sure to have set JAVA_HOME properly since jpype depends on this setting.
The constructor takes a keyword argument extractor, being one of the available boilerpipe extractor types:
- DefaultExtractor
- ArticleExtractor
- ArticleSentencesExtractor
- KeepEverythingExtractor
- KeepEverythingWithMinKWordsExtractor
- LargestContentExtractor
- NumWordsRulesExtractor
- CanolaExtractor
If no extractor is passed the DefaultExtractor will be used by default. Additional keyword arguments are either html for HTML text or url.
from boilerpipe.extract import Extractor
extractor = Extractor(extractor='ArticleExtractor', url=your_url)
Then, to extract relevant content:
extracted_text = extractor.getText()
extracted_html = extractor.getHTML()
For KeepEverythingWithMinKWordsExtractor we have to specify kMin parameter, which defaults to 1 for now:
extractor = Extractor(extractor='KeepEverythingWithMinKWordsExtractor', url=your_url, kMin=20)
관련 프로젝트 살펴보기
불러오는 중…