Python中pyBibx库是文献计量学分析较好的库,有着丰富的方法。
1 安装
pip install pyBibx
2 数据
见本文绑定资源
3 实战分析
3.1 导入数据和总结汇报
import numpy as np
import pandas as pd
import textwrap
from pyBibX.base import pbx_probe
from prettytable import PrettyTable
file_name = 'pubmed.txt'
database = 'pubmed'
# load data
bibfile = pbx_probe(file_bib=file_name, db=database, del_duplicated=True)
# Generate EDA (Exploratory Data Analysis) Report
report = bibfile.eda_bib()
# Check Report
report
3.2 词云
bibfile.word_cloud_plot(entry='kwa', size_x=15, size_y=10, wordsn=500)
3.3 词语重要性排序
# Check Table for important word
table = PrettyTable()
data_wd = bibfile.ask_gpt_wd
table.field_names = ['Word', 'Importance']
for key, value in data_wd.items():
table.add_row([key, round(value, 4)])
print(table)
3.4 N-Grams:是文本文档中n个连续项目的集合,可能包括单词、数字、符号和标点符号。
bibfile.get_top_ngrams(view='notebook', entry='kwp', ngrams=4, stop_words=[], rmv_custom_words=[], wordsn=15)
3.5 文章聚类
projection, labels = bibfile.docs_projection(view='notebook',corpus_type='abs',
stop_words=['en'],rmv_custom_words=[],
custom_label=[],custom_projection=[],
n_components=2,n_clusters=5,
tf_idf=False,embeddings=False,
method='umap')
data_pr = pd.DataFrame(np.hstack([projection, labels.reshape(-1,1)]))
# Check Articles per Cluster
cluster = 1
idx_articles = [i for i in range(0, labels.shape[0]) if labels[i] == cluster]
print(*idx_articles, sep=', ')
3.6 每年关键词变化
bibfile.plot_evolution_year(view='notebook',
stop_words=['en'],
rmv_custom_words=[],
key='kwp',
topn=10,
start=2010,
end=2021)
# View Table
data_ep = bibfile.ask_gpt_ep
3.7 作者/国家/杂志桑基图
bibfile.sankey_diagram(view='notebook', entry=['aut', 'cout', 'inst', 'lan'], topn=10)
# View Table
data_sk = bibfile.ask_gpt_sk
pd.DataFrame(data_sk)
3.8 杂志热图
bibfile.tree_map(entry='jou', topn=20, size_x=30, size_y=30)
3.9 作者产出图
bibfile.authors_productivity(view='notebook', topn=20)
3.10 作者产出柱状图
bibfile.plot_bars(statistic='apd', topn=20, size_x=15, size_y=10)
# View Table
data_bp = bibfile.ask_gpt_bp
3.11 合作网络图
bibfile.network_adj(view = 'notebook', adj_type = 'aut', min_count = 5, node_labels = True, label_type = 'name', centrality = None)
# PS: If a centrality criterion is used then the values can be obtained by the following command: bibfile.table_centr
# View Table
data_adj = bibfile.ask_gpt_adj
bibfile.find_nodes(node_ids = [], node_name = ['youngkong s'], node_only = False)
3.12 合作世界地图
bibfile.network_adj_map(view = 'browser', connections = True, country_lst = [])
3.13 NLP:自然语言处理
# NLP
# Arguments: corpus_type = 'abs', 'title', 'kwa', or 'kwp';
# stop_words = A list of stopwords to clean the corpus. ['ar', 'bn', 'bg', 'cs', 'en', 'fi', 'fr', 'de', 'el', 'hi', 'he', 'hu', 'it', 'ja', 'ko', 'mr', 'fa', 'pl', 'pt-br', 'ro', 'ru', 'es', 'sv', 'sk', 'zh', 'th', 'uk'];
# 'ar' = Arabic; 'bn' = Bengali; 'bg' = Bulgarian; 'cs' = Czech; 'en' = English; 'fi' = Finnish; 'fr' = French; 'de' = German; 'el' = Greek; 'he' = Hebrew;…n;
# 'ja' = Japanese; 'ko' = Korean; 'mr' = Marathi; 'fa' = Persian; 'pl' = Polish; 'pt-br' = Potuguese-Brazilian; 'ro' = Romanian; 'ru' = Russian; 'es' = Spanish; 'sk' = Slovak; 'sv' = Swedish;
# 'zh' = Chinese; 'th' = Thai; 'uk' = Ukrainian
# rmv_custom_words = A list of custom stopwords to clean the corpus;
bibfile.create_embeddings(stop_words = ['en'], rmv_custom_words = [], corpus_type = 'abs')
emb = bibfile.embds
# NLP #-1 refers to all outliers and should typically be ignored.
# Arguments: stop_words = A list of stopwords to clean the corpus. ['ar', 'bn', 'bg', 'cs', 'en', 'fi', 'fr', 'de', 'el', 'hi', 'he', 'hu', 'it', 'ja', 'ko', 'mr', 'fa', 'pl', 'pt-br', 'ro', 'ru', 'es', 'sv', 'sk', 'zh', 'th', 'uk'];
# 'ar' = Arabic; 'bn' = Bengali; 'bg' = Bulgarian; 'cs' = Czech; 'en' = English; 'fi' = Finnish; 'fr' = French; 'de' = German; 'el' = Greek; 'he' = Hebrew;'hi' = Hindi; 'hu' = Hungarian; 'it' = Italian;
# 'ja' = Japanese; 'ko' = Korean; 'mr' = Marathi; 'fa' = Persian; 'pl' = Polish; 'pt-br' = Potuguese-Brazilian; 'ro' = Romanian; 'ru' = Russian; 'es' = Spanish; 'sk' = Slovak; 'sv' = Swedish;
# 'zh' = Chinese; 'th' = Thai; 'uk' = Ukrainian
# rmv_custom_words = A list of custom stopwords to clean the corpus;
# embeddings = True or False. If True then word embeddings are used to create the topics
bibfile.topics_creation(stop_words = ['en'], rmv_custom_words = [], embeddings = True)
# NLP
# Each document Topic
topics = bibfile.topics
# NLP
# Each document Probability to belong a Topic
probs = bibfile.probs
# NLP
# Arguments: view = 'notebook', 'browser' ('notebook' -> To plot in your prefered Notebook App. 'browser' -> To plot in your prefered browser window)
bibfile.graph_topics_distribution(view = 'notebook')
# NLP
# Arguments: view = 'notebook', 'browser' ('notebook' -> To plot in your prefered Notebook App. 'browser' -> To plot in your prefered browser window)
bibfile.graph_topics(view = 'notebook')
# NLP
# Arguments: view = 'notebook', 'browser' ('notebook' -> To plot in your prefered Notebook App. 'browser' -> To plot in your prefered browser window)
bibfile.graph_topics_projection(view = 'notebook')
# NLP
# Arguments: view = 'notebook', 'browser' ('notebook' -> To plot in your prefered Notebook App. 'browser' -> To plot in your prefered browser window)
bibfile.graph_topics_heatmap(view = 'notebook')
# NLP
similar_topics, similarity = bibfile.topic_model.find_topics('electre', top_n = 10)
for i in range(0, len(similar_topics)):
print('Topic: ', similar_topics[i], 'Correlation: ', round(similarity[i], 3))
# NLP
bibfile.topic_model.save('my_topic_model')
abs_summary = bibfile.summarize_abst_peg(article_ids = [305, 34, 176], model_name = './pegasus-xsum')
# NLP - Check Abstractive Summarization
print(textwrap.fill(abs_summary, 150))
abs_summary_chat = bibfile.summarize_abst_chatgpt(article_ids = [305, 34, 176], join_articles = True, api_key = 'your_api_key_here', query = 'from the following scientific abstracts, summarize the main information in a single paragraph using around 250 words', model = 'gpt-4')
# NLP - Check Abstractive Summarization
print(textwrap.fill(abs_summary_chat, 250))
# NLP - Extractive Summarization
# Arguments: article_ids = A list of documents to perform an extractive summarization with the available abstracts. If the list is empty then all documents will be used
ext_summary = bibfile.summarize_ext_bert(article_ids = [305, 34, 176])
# NLP - Check Extractive Summarization
print(textwrap.fill(ext_summary, 150))
上述可总结摘要
3.14 筛选文章
bibfile.filter_bib(documents = [], doc_type = [], year_str = -1, year_end = -1, sources = [], core = -1, country = [], language = [], abstract = False)
感兴趣的可以参考原始指南:
文章浏览阅读1.1k次。一、选择题1. 串行接口是指( )。A. 接口与系统总线之间串行传送,接口与I/0设备之间串行传送B. 接口与系统总线之间串行传送,接口与1/0设备之间并行传送C. 接口与系统总线之间并行传送,接口与I/0设备之间串行传送D. 接口与系统总线之间并行传送,接口与I/0设备之间并行传送【答案】C2. 最容易造成很多小碎片的可变分区分配算法是( )。A. 首次适应算法B. 最佳适应算法..._874 计算机科学专业基础综合题型
文章浏览阅读9.7k次,点赞5次,收藏15次。连接xshell失败,报错如下图,怎么解决呢。1、通过ps -e|grep ssh命令判断是否安装ssh服务2、如果只有客户端安装了,服务器没有安装,则需要安装ssh服务器,命令:apt-get install openssh-server3、安装成功之后,启动ssh服务,命令:/etc/init.d/ssh start4、通过ps -e|grep ssh命令再次判断是否正确启动..._could not connect to '192.168.17.128' (port 22): connection failed.
文章浏览阅读209次。00000000_杰理 空白芯片 烧入key文件
文章浏览阅读475次。2023年初,“ChatGPT”一词在社交媒体上引起了热议,人们纷纷探讨它的本质和对社会的影响。就连央视新闻也对此进行了报道。作为新传专业的前沿人士,我们当然不能忽视这一热点。本文将全面解析ChatGPT,打开“技术黑箱”,探讨它对新闻与传播领域的影响。_引发对chatgpt兴趣的表述
文章浏览阅读259次。用Python数据分析方法进行汉字声调频率统计分析木合塔尔·沙地克;布合力齐姑丽·瓦斯力【期刊名称】《电脑知识与技术》【年(卷),期】2017(013)035【摘要】该文首先用Python程序,自动获取基本汉字字符集中的所有汉字,然后用汉字拼音转换工具pypinyin把所有汉字转换成拼音,最后根据所有汉字的拼音声调,统计并可视化拼音声调的占比.【总页数】2页(13-14)【关键词】数据分析;数据可..._汉字声调频率统计
文章浏览阅读64次。最近在做一个android系统移植的项目,所使用的开发板com1是调试串口,就是说会有uboot和kernel的调试信息打印在com1上(ttySAC0)。因为后期要使用ttySAC0作为上层应用通信串口,所以要把所有的调试信息都给去掉。参考网上的几篇文章,自己做了如下修改,终于把调试信息重定向到ttySAC1上了,在这做下记录。参考文章有:http://blog.csdn.net/longt..._嵌入式rootfs 输出重定向到/dev/console
文章浏览阅读1.2k次,点赞4次,收藏12次。1,先去iconfont登录,然后选择图标加入购物车 2,点击又上角车车添加进入项目我的项目中就会出现选择的图标 3,点击下载至本地,然后解压文件夹,然后切换到uniapp打开终端运行注:要保证自己电脑有安装node(没有安装node可以去官网下载Node.js 中文网)npm i -g iconfont-tools(mac用户失败的话在前面加个sudo,password就是自己的开机密码吧)4,终端切换到上面解压的文件夹里面,运行iconfont-tools 这些可以默认也可以自己命名(我是自己命名的_uniapp symbol图标
文章浏览阅读1.2w次,点赞25次,收藏192次。char*和char[]都是指针,指向第一个字符所在的地址,但char*是常量的指针,char[]是指针的常量_c++ char*
文章浏览阅读930次。代码编辑器或者文本编辑器,对于程序员来说,就像剑与战士一样,谁都想拥有一把可以随心驾驭且锋利无比的宝剑,而每一位程序员,同样会去追求最适合自己的强大、灵活的编辑器,相信你和我一样,都不会例外。我用过的编辑器不少,真不少~ 但却没有哪款让我特别心仪的,直到我遇到了 Sublime Text 2 !如果说“神器”是我能给予一款软件最高的评价,那么我很乐意为它封上这么一个称号。它小巧绿色且速度非
文章浏览阅读4.1k次。一、选择法这是每一个数出来跟后面所有的进行比较。2.冒泡排序法,是两个相邻的进行对比。_对十个数进行大小排序java
文章浏览阅读2.9k次。物联网开发笔记——使用网络调试助手连接阿里云物联网平台(基于MQTT协议)其实作者本意是使用4G模块来实现与阿里云物联网平台的连接过程,但是由于自己用的4G模块自身的限制,使得阿里云连接总是无法建立,已经联系客服返厂检修了,于是我在此使用网络调试助手来演示如何与阿里云物联网平台建立连接。一.准备工作1.MQTT协议说明文档(3.1.1版本)2.网络调试助手(可使用域名与服务器建立连接)PS:与阿里云建立连解释,最好使用域名来完成连接过程,而不是使用IP号。这里我跟阿里云的售后工程师咨询过,表示对应_网络调试助手连接阿里云连不上
文章浏览阅读544次,点赞5次,收藏6次。运算符与表达式任何高级程序设计语言中,表达式都是最基本的组成部分,可以说C++中的大部分语句都是由表达式构成的。_无c语言基础c++期末速成