Changes between Version 11 and Version 12 of Justext
- Timestamp:
- 02/06/19 16:03:16 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Justext
v11 v12 11 11 12 12 == Installation == 13 1. Make sure you have Python and lxml library version 2.2.4or later installed.13 1. Make sure you have Python and lxml library version 4.1 or later installed. 14 14 2. Download the sources: 15 15 {{{ 16 wget http://corpus.tools/raw-attachment/wiki/Downloads/justext-1. 4.tar.gz16 wget http://corpus.tools/raw-attachment/wiki/Downloads/justext-1.5.tar.gz 17 17 }}} 18 18 3. Extract the downloaded file: 19 19 {{{ 20 tar xzvf justext-1. 4.tar.gz20 tar xzvf justext-1.5.tar.gz 21 21 }}} 22 22 4. Install the package (you may need sudo or a root shell for the latter command): 23 23 {{{ 24 cd justext-1. 4/24 cd justext-1.5.1/ 25 25 python setup.py install 26 26 }}} … … 37 37 38 38 == Python API == 39 Python 3.6 & Python 2.7 compatible 39 40 {{{ 40 import urllib241 41 import justext 42 import requests 43 page = requests.get('http://planet.python.org/').text.encode('utf-8') 42 44 43 page = urllib2.urlopen('http://planet.python.org/').read()44 45 paragraphs = justext.justext(page, justext.get_stoplist('English')) 45 46 for paragraph in paragraphs: 46 47 if paragraph['class'] == 'good': 47 print paragraph['text'] 48 print(paragraph['text']) 49 48 50 }}} 49 51