后真相时代的新闻文章元数据服务。
metadoc的Python项目详细描述
元文档
metadoc是后真理时代的新闻文章元数据检索服务。它基于任意的文章url进行社交媒体活动查找、源真实性评级、校验和创建、json-ld和元标记解析以及命名实体、pullquotes、fulltext和其他有用内容的信息提取。此外,metadoc的构建速度相对较快。
示例
只要抛出任何新闻文章的url,metadoc就会产生结果。
frommetadocimportMetadocurl="https://theintercept.com/2016/11/17/iphones-secretly-send-call-history-to-apple-security-firm-says"metadoc=Metadoc(url=url)res=metadoc.query()
=>;
{'__version__':'0.9.0','authors':['Kim Zetter'],'canonical_url':'https://theintercept.com/2016/11/17/iphones-secretly-send-call-history-to-apple-security-firm-says/','domain':{'credibility':{'fake_confidence':'0.00','is_blacklisted':False},'date_registered':None,'favicon':'https://logo.clearbit.com/theintercept.com?size=200','name':'theintercept.com'},'entities':{'keywords':['cellebrite','fbi','skype','intercept'...]}},'image':'https://theintercept.imgix.net/wp-uploads/sites/1/2016/11/GettyImages-578052668-s.jpg?auto=compress%2Cformat&q=90&fit=crop&w=1200&h=800','language':'en','modified_date':None,'published_date':'2016-11-17T11:00:36+00:00','scraped_date':'2018-07-10T12:13:46+00:00','social':[{'metrics':[{'count':7340,'label':'sharecount'}],'provider':'facebook'}],'text':{'contenthash':'940a62c70db255b4aec378529ae7a2c8','fulltext':'a guardian of user privacy this year after fighting FBIdemandstohelpcrackintoSanBernardinoshooterSyed...','reading_time':439,'summary':'Your call logs get sent to Apple’s servers whenever iCloud is on — something Apple does not disclose.'},'title':'iPhones Secretly Send Call\xa0History to Apple, Security Firm Says','url':'https://theintercept.com/2016/11/17/iphones-secretly-send-call-history-to-apple-security-firm-says'}
可信度检查
metadoc对文章源进行基本的背景检查。这意味着通过域上的whois
数据进行简单的黑名单查找。考虑到的黑名单包括有争议的PropOrNot。因此,只有在每个黑名单上找到一个域,我们才会抛出1的fake_confidence
。得到的元数据应该是一丁点盐。
词性标注
为了速度和简单,我们决定不使用nltk
,而是使用matthew honnibal @explosion所设想的平均感知器。pip安装是经过预训练的CoNLL 2000训练集,可以很好地检测专有名词。由于训练是不确定的,不需要的停止语可能会溜走。如果您想尝试其他数据集,只需用自己的数据集替换metadoc/extract/data/training_set.txt
,然后运行metadoc.extract.pos.do_train
。
目的
此库用于名为Praise的新闻相关软件任务的上下文中。我们正在建立第一个致力于高质量新闻推荐的社交网络。将我们称之为“受众评估内容”的内容与自动化元数据进行综合。如果您感兴趣,可能想与我们合作,请随时给a@praise.press留言。
安装
需要Python3.5。
使用pip
pip install metadoc
开发
Mac操作系统
brew install python3 libxml2 libxslt libtiff libjpeg webp little-cms2
ubuntu
apt-get install -y python3 libxml2-dev libxslt-dev libtiff-dev libjpeg-dev webp whois
软呢帽
dnf install libxml2-devel libxslt-devel libtiff-devel libjpeg-devel libjpeg-turbo-devel libwebp whois
然后
pip3 install -r requirements-dev.txt
python serve.py => serving @ 6060
测试
py.test -v tests
如果您碰巧遇到osx 10.11中关于pil中的延迟绑定库的错误,
只需删除/PIL/.dylibs/liblzma.5.dylib
。
待办事项
- 为了正确计算字数和读取时间,需要页连接。
- 使用ShareCount偏差检测的真实性启发式(需要状态)。
- 最坏的罪犯是NLTK的POS标签。使用普通感知器滚动。
报纸的摘要产生引语,全文需要一段时间。移到libextract?
贡献者
meteadoc是一个软件产品赞扬互联网ug,汉堡。
metadoc源于goose3、langdetect和nltk等优秀库的血统。
metadoc依赖于this感知器实现,灵感来自matthew honnibal。
metadoc是一个正在进行的工作。