从文本、html或url解析句子。
sentenceparser的Python项目详细描述
句子分析器
从文本、html或url解析句子。
安装
pip install sentenceparser
用法
使用cli解析文本文件中的句子:
sentenceparser from-text ~/Documents/text.txt
使用cli解析html文件中的句子:
sentenceparser from-html ~/Documents/site.html
使用cli解析url中的句子:
sentenceparser from-url 'https://example.com/'
使用cli解析url中的句子,并为每个句子添加行号:
sentenceparser from-url 'https://example.com/' --line-number
使用python api解析文本文件中的句子:
importsentenceparsertext='Lorem ipsum dolor sit amet consectetur adipisicing elit...'forsentenceinsentenceparser.from_text(text):print(sentence)
使用python api解析html文件中的句子:
importsentenceparserhtml='<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p><p>...'forsentenceinsentenceparser.from_html(html):print(sentence)
使用python api解析url中的句子:
importsentenceparserforsentenceinsentenceparser.from_url('https://example.com/'):print(sentence)
开发
拉动:
git pull git@github.com:2tunnels/sentenceparser.git
安装:
pipenv install --dev
测试:
pytest