APP下载

基于Python的Web信息获取方法研究

2018-02-01魏冬梅何忠秀唐建梅

软件导刊 2018年1期

魏冬梅+何忠秀+唐建梅

摘要:随着大数据和云计算等新一代互联网技术的迅速发展,Web信息量逐日海量递增。从海量数据中提取有效信息,挖掘有潜在价值的关系成为当前的研究热点,这对揭示已知规律、预测未知结果有极大的辅助作用。对当前Web信息获取方法、原理和关键技术进行研究分析,重点阐述了数据采集相关技术中网络爬虫算法的分类与应用。提出一种以Python和相关库为主要工具,结合模块化方法,构建Web文本信息获取系统框架与流程的策略。案例中通过定义采集函数,实现对给定的维基百科词条,快速搜索与该词条相关信息,对词条内链接和外链接进行有效爬取。结果表明,Python在数据采集方面具有较高的有效性和可扩展性。

关键词:Python;信息获取;网络爬虫;正则表达式

DOIDOI:10.11907/rjdk.172302

中图分类号:TP301

文献标识码:A文章编号文章编号:16727800(2018)001004103

Abstract:As the development of big data and cloud computing, an increasing number of information has been boosted significantly. Extracting the information and extract useful information from huge amounts of data effectively has been becoming the current hot spot. Moreover, it has contributed to revealing the known regulations and predicting unknown results. In this paper, the current Web information retrieval method, the principle and key technology has been analyzed and the algorithm, classification and application of Web crawler in data acquisition technology are emphasized. This paper presents a method of constructing Web text information acquisition system based on Python and related libraries. In the case, by defining the regular expressions and crawling function, it realized searching for the relevant information of the entry, and effectively retrievaling the internal links and the external links. The results show that Python has significant efficiency and expansibility in data retrieval.

Key Words:Python; information access; Web crawler; regular expression

0引言

互聯网提供了大量数据集,但是由于网站本身的多样化和异构性以及网页文档结构的复杂性,很多数据都被嵌入到网页结构与样式中。Web信息获取,也称为基于Web的知识发现。Web数据获取技术分为:基于本体的数据获取、基于自然语言的数据获取、基于网站查询的数据获取、基于规则和地理位置的数据获取。利用行之有效的方法,将可用的信息从海量数据中抽取出来,挖掘潜在价值,将在金融、电信业、舆情监控、数据分析以及其他科学领域发挥重要作用。由此可见,获取Web信息的技术显得尤为关键。

1Web信息获取技术

登录APP查看全文