基于启发式的样板删除工具
jusText的Python项目详细描述
justext
程序justext是一个删除样板内容的工具,例如导航 HTML页面中的链接、页眉和页脚。它是 designed保存 主要是包含完整句子的文本,因此它非常适合 创建语言资源,如网络语料库。你可以 try it online。
这是jusText托管的原始(当前未维护)代码的叉 关于谷歌代码。下面是我发现的一些替代方案:
- https://github.com/bookieio/breadability
- http://code.google.com/p/boilerpipe/
- http://sourceforge.net/projects/webascorpus/?source=navbar
- https://github.com/jiminoc/goose
- https://github.com/grangier/python-goose
- https://github.com/dcramer/decruft
- https://github.com/FeiSun/ContentExtraction
- https://github.com/JalfResi/justext
- https://github.com/andreypopp/extracty/tree/master/justext
- https://github.com/dreamindustries/jaws/tree/master/justext
- https://github.com/says/justext
- https://github.com/chbrown/justext
- https://github.com/says/justext-app
依赖性
lxml>=2.2.4
使用量
$ 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
importrequestsimportjustextresponse=requests.get("http://planet.python.org/")paragraphs=justext.justext(response.content,justext.get_stoplist("English"))forparagraphinparagraphs:ifnotparagraph.is_boilerplate:printparagraph.text
测试
通过运行测试
$ py.test-2.6 && py.test-3.3 && py.test-2.7 && py.test-3.4 && py.test-3.5
确认
这个软件是在 Masaryk University in Brno得到PRESEMT和 Lexical Computing Ltd.它还与扬·波米克·列克的{a26}有关。
justext的更改日志
2.2.0(2016-03-06)
- 不兼容的更改:停止字不区分大小写。
- 不兼容的更改:放弃了对python 3.2的支持
- bug修复:保留段落中原始文本的新行。
2.1.1(2014-05-27)
- 错误修复:函数decode_html现在在落在default_encoding#9时尊重参数errors。
2.1.0(2014-01-25)
- feature:向paragrahs添加了xpath选择器。xpath选择器在详细输出中也可用作<p>标记#5的xpath属性。
2.0.0(2013-08-26)
- 功能:添加了可插入的dom预处理器。
- 特性:添加了对python 3.2+的支持。
- 不兼容的更改:段落是 justext.paragraph.Paragraph。
- 不兼容的更改:删除“justext”脚本以支持 命令python -m justext。
- 功能:可以在cli中输入uri作为输入文档。
- 功能:可以直接传递unicode字符串。
1.2.0(2011-08-08)
- 功能:在可能的情况下使用字符数而不是单词数 使算法在独立于语言的环境下运行良好 计数单词为的语言的模式(不带停止列表) 不容易(日语、汉语、泰语等)。
- bug修复:对包含有关 使用字符集。
- bug修复:更正了对html实体的解码&;128;到&;159;
1.1.0(2011-03-09)
- 首次公开发行。