人工智能分析系统总计

数据爬取:

结构化数据从计算机学会等网站拿到scopusid,类似doi 文献的唯一表示符号,没有sid部分用title标题进行查找。

sid查找从scopus网站接口每个keyid可以接受20万条请求所以要用多个keylist

防止被反爬虫禁止,用user-agin列表

  url = 'http://api.elsevier.com/content/abstract/scopus_id/' + str(sid)
utl=url+‘field=citedbycount,aggregationType,doi,coverDate,publicationName,authkeywords,url,identifier,description,author,affiliation,title&apiKey=' + apikeyList[keyIndex]

urllib.request():getHTMLFromURLlib通过url获得HTML,xmltodict(html)解析XML,使其可以像json 一样操作,类似字典。
 

例如获得作者信息 for item in doc['abstracts-retrieval-response']['authors']['author']多个作者获得第一个

author['id'] = item['@auid']作者id,通常为唯一的scopus
 author['url'] = item['author-url'].replace("'","''")
 author['rank'] = item['@seq']排名

对于所属机构有所不同,if isinstance(item['affiliation'], list),可能在多个机构内需判断是否为list,是的话存为list,在数据库存储用 | 分开。

循环list获取的信息:文章信息207099c74960a1eb83c13ba1c60d045
id —— 72749097462         sid
doi —— 10.3109/00365510903431759
title —— Editorial: Course in scientific writing the arctic experience
articleType —— Journal
citation —— 0
journal —— Scandinavian Journal of Clinical and Laboratory Investigation
date —— 2009-12-31
abstractLang —— 
abstract —— 
authorKeywords —— []
author {'id': '7003271910', 'url': 'https://api.elsevier.com/content/author/author_id/7003271910', 'rank': '1', 'simname': 'Hagve T.-A.', 'firstname': 'Hagve', 'lastname': 'Tor-Arne', 'simlastname': 'T.A.', 'fullname': 'Hagve Tor-Arne', 'affiliation': ['60068728', '60068728']}

affi机构{'id': '60068728', 'url': 'https://api.elsevier.com/content/affiliation/affiliation_id/60068728', 'name': 'Akershus University Hospital', 'city': 'Lorenskog', 'country': 'Norway'}

数据库存储,在存储之前判断是否存在article(sid),author(aid),affi(id)在数据库内如果没有插入,有则查看数据库内author的article信息,对比该文章是否存储,没存储|添加,文章表内也需要对比,没有增加

title从semantic中获取信息:
    url = "https://www.semanticscholar.org/search?q="+value

获取到大量匹配的title的文章html 信息,用   jsonDict = json.loads(dic)将获得json数据转为字典dic

Levenshtein编辑距离算法获得第一个字符串的近似值<0.1表示很近似

dict["rel"] = Levenshtein.distance(str(jsonDict["title"]["text"].lower()), str(values["q"].lower())) / float(
        len(title))

获取该符合文章的doi:

后从接口http://api.semanticscholar.org/v1/paper/10.3109/00365510903431759(doi)返回json和scopus类似操作

猜你喜欢

转载自blog.csdn.net/qq_23700265/article/details/81222673