8 Star 51 Fork 13

Gitee 极速下载/GNE

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/kingname/GeneralNewsExtractor
克隆/下载
example_visiable.py 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
kingname 提交于 2022-09-22 22:55 . 默认不对标点符号进行归一化
import json
import glob
from gne import GeneralNewsExtractor
if __name__ == '__main__':
# html_list = glob.glob('visiable_test/khan/*.html', recursive=True)
html_list = glob.glob('/Users/kingname/Jupyter/news.html', recursive=True)
for html_file in html_list:
with open(html_file, encoding='utf-8') as f:
html = f.read()
extractor = GeneralNewsExtractor()
result = extractor.extract(html,
host='https://www.xxx.com',
# body_xpath='//div[@class="show_text"]',
noise_node_list=['//div[@class="comment-list"]',
'//*[@style="display:none"]',
'//div[@class="statement"]'
],
normalize=False,
use_visiable_info=True)
print(f'>>>>>>>>>>>>>{html_file}>>>>>>>>>>>>>')
print(json.dumps(result, indent=2, ensure_ascii=False))
print('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mirrors/GNE.git
git@gitee.com:mirrors/GNE.git
mirrors
GNE
GNE
master

搜索帮助