附代码 基于NLP的COVID-19虚假新闻检测( 三 )
polarity_source.py

文章插图
图十
这意味着《纽约时报》的新闻和数据中的自然新闻听起来不那么具有情绪 。
可以用以下小提琴图(violin plot)来证实:
1. fig = go.Figure()2.3. sources = ['https://www.health.harvard.edu/', 'https://www.nytimes.com/', 'Facebook', 'https://www.naturalnews.com/']4.5. for source in sources:6.fig.add_trace(go.Violin(x=df['source'][df['source'] == source],7.y=df['polarity'][df['source'] == source],8.name=source,9.box_visible=True,10.meanline_visible=True))11. fig.update_layout(title_text='Polarity of four sources', template='plotly_white')12. fig.show()source_violin.py
文章插图
图十一
- 情绪vs文章长度vs真实性
1. fig = px.density_contour(df, x='polarity', y='text_len', marginal_x='histogram', marginal_y='histogram', template='plotly_white')2. fig.update_layout(title_text='Sentiment vs. Article length')3. fig.show()len_polarity.py
文章插图
图十二
情感与文章的长度之间没有明显的关系 。通常 , 文章的情感或篇幅不能反映其真实性 。虚假新闻与真实新闻之间的区别可能是相当随意的 。
1. fig = px.scatter(df, x='polarity', y='text_len', color='label', template="plotly_white")2. fig.update_layout(title_text='Sentiment polarity')3. fig.show()polarity_scatter.py
文章插图
图十三
df.groupby(['source']).mean().sort_values('polarity', ascending=False)
文章插图
图十四
我注意到鲁迪·朱利安妮(Rudy Giuliani)的帖子是情感评分最高的帖子之一 , 所以我很好奇想知道这篇帖子是关于什么的:
df.loc[df['source'] == 'RudyGiuliani']['text'][880]
文章插图
当然是关于羟氯喹(Hydroxychloroquine)的啦~ 。
真实与虚假新闻的内容
现在 , 我们将了解数据集中包含哪些主题:
1. common_bigram_true = get_top_n_bigram(df.loc[df['label'] == 'TRUE']['text'], 20)2. for word, freq in common_bigram_true:3.print(word, freq)true_bigram.py
文章插图
1. common_bigram_fake = get_top_n_bigram(df.loc[df['label'] == 'FAKE']['text'], 20)2. for word, freq in common_bigram_fake:3.print(word, freq)fake_bigram.py
文章插图
- 促进治愈:这包括使用大剂量静脉注射维生素C 。
- 关于起源的推测:这个主题包括声称冠状病毒是在用于生物武器的实验室中制造的 , 或者是5G技术导致了这种疾病 。
- 关于有影响力人士的谣言:例如比尔·盖茨和福西博士代表制药公司策划了冠状病毒 。
- 应对人们的恐惧:例如梅林达·盖茨基金会和约翰·霍普金斯大学在三个月前通过Event 201预测了冠状病毒 。
naturalnews.com vs orthomolecular.org以上两个新闻来源都提倡阴谋论 , 但是它们却关注不同的主题 。1. naturalnews_bigram = get_top_n_bigram(df.loc[df['source'] == 'https://www.naturalnews.com/']['text'], 20)2. for word, freq in naturalnews_bigram:3.print(word, freq)natural_bigram.py
文章插图
naturalnews.com一直在传播虚假信息 , 例如在中国实验室将冠状病毒设计为生物武器 , 并且/或者传播病毒来掩盖暴露于5G无线技术有关有害健康的影响 。
推荐阅读
- 含完整源代码和开发文档 人工智能图像识别绘本阅读方案
- 如何基于TCP/IP协议进行MFC Socket网络通讯编程
- 500以下无线键盘简评,附高斯GS87D体验总结
- Python量化工具之“k线波幅加速”算法跟踪止盈,仅需一行代码
- 基于XML描述的可编程函数式ETL实现
- 教你如何用android mvp分层架构优雅写代码
- 一行代码搞定百度文库VIP功能
- 带你读懂信息安全中的恶意代码、病毒、木马、蠕虫......
- 常见分布式锁实现方式
- 恶意代码分析之Office宏代码分析
