`
john2007
  • 浏览: 76151 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

几个有趣的python开源项目

阅读更多

一直都对搜索引擎很感兴趣,因此有一个是python的蜘蛛程序。另一个是用python操作pdf格式文件。

 

1、用python来做一个蜘蛛程序抓取网页,有了urllib库,真是太简单了。另外网页的解析也有相应的库sgmllib可以使用。不过还不知道python的sgmllib有没有类似 Jtidy 的规范html代码的功能,或者是有另外的库来干这事。

比较有名气的:

Harvest Man------http://code.google.com/p/harvestman-crawler/

HarvestMan is a modular, extensible and flexible web crawler program cum framework written in pure Python. HarvestMan can be used to download files from websites according to a number of customized rules and constraints. It can be used to find information from websites matching keywords or regular expressions.

The final goal of the project is to develop a full-fledged semantic personal data mining platform which can be used to retrieve information from the Internet in a highly customizable manner, so that one can fetch information from the web the way he wants it, when he wants it. For this, HarvestMan project will provide support for Web 2.0 and 3.0 technologies such as RSS, RDF, OWL etc. (这个目标还真是大啊,要是真的可以做到那就真是牛逼。)

 

 

另外,还有一些小的项目,用Google code或者 sourceforge.net搜索,就可以找到。

举个例子:

http://code.google.com/p/supercrawler/

 

2、对pdf文件的操作,C++,c#和java都有一些开源的类库可以使用。比如:pdflib,itext,pdfclown,pdfbox.

他们可以实现pdf文件的解析,并实现pdf与rtf html xml等格式之间的相互转换。

今天发现了一个可以操作pdf的python库: pdfminer.

http://code.google.com/p/pdfminerr/

不知道有没有其他的库。希望高手补充。

 

3、有了pdf的操作库,可以轻松实现对pdf文件内容的有目的的抽取。

这里有一个抽取文献的参考文献的例子:

pdf2ref

http://code.google.com/p/pdftoref/

 

This project aims to develop an efficient rule based extractor of entries of references, located in scientific articles in English language. The application takes a pdf file or a directory of pdf and then returns an html file, containing the list of all entries with their respective title. Moreover the title of the article cited is searched through Google Web Service to get the URL that identifying the article on the web. If the URL provides on the page a Bibtex entry, this will appear in the html output under the relative entries, stolen from some typical site like citeseer, ieeexlpore etc. The application does not make search over pdf file based on images.

Result

ImplementationPdfminer tool, a pure python lib to manage pdf; instead to query Google Web Service it uses Python SoapPy. This project is born into the course of "Data Base II and Information Retreival" of Master Computer Science at the University of Florence from two engineers. The project is released under the GNU General Public License.

In this way, the best result will be the html files with all entries with their rispective title linked to the URI and below the Bibtex entry. See example below.

The tool is implemented through python scripting and created to run on GNU/Linux. It uses as backend

UsageExamples of UsageExamples of OutputThe article in pdf text format

user@machine:~$ pdftoref --help
     Usage: 

     -h            --help              This help Command 
     -f filepath   --file=filepath     Run on a file 
     -d directory  --dir=directory     Run into a directory 
     -u            --url               Get the title url 
     -b            --bibtex            Get the bibtex article 
 
     Examples:

     pdftoref -b -u -f ~/file.pdf
     pdftoref --url --bibtex --file=~/file.pdf
     pdftoref -d /home/user/articles 

Extract the referencies from a file

user@machine:~$pdftoref -u -b -f /home/lizardking/path/to/file.pdf

The output will be:

PdftoRef> Running on the file: /home/lizardking/path/to/file.pdf
* Extracting the text from pdf      [Done]
* Extracting the entries and titles      [Done]
* Querying Google and writing down html file      [Done]
PdftoRef> Finished file: /home/lizardking/path/to/file.pdf

Then run to see result:

user@machine:~$firefox /home/lizardking/path/to/file.html

Almost the same for extract the referencies from files in a directory, except that it will use on all pdf files.

user@machine:~$pdftoref -d /home/lizardking/path/to/dir/
分享到:
评论

相关推荐

    Python开源的Web框架Django.zip

    Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC)风格的 Web 应用程序框架。使用 Django,我们在几分钟之内就可以创建高品质、易维护、数据库驱动的应用程序。Django 框架的核心组件有:用于创建...

    Python 开源项目之「自学编程之路」.zip

    爬虫的工作流程包括以下几个关键步骤: URL收集: 爬虫从一个或多个初始URL开始,递归或迭代地发现新的URL,构建一个URL队列。这些URL可以通过链接分析、站点地图、搜索引擎等方式获取。 请求网页: 爬虫使用HTTP...

    第一个“活机器人”开源项目 Robi-Transform-Project-master.zip

    得到一个覆盆子pi,连接几个电机和一个扬声器/麦克风,好吧,它准备好了。您可以播放,更改代码,再试一次。虽然粗糙但基本上满足了玩它的需要(子功能也需要各种改进)。 什么是“活机器人”? 想象一下,如果你有...

    基于python实现将Excel数据导入到MySQL数据库附项目源码

    Python 的第一个公开发行版发行于 1991 年。Python 的官方定义:Python 是一种解释型的、面向对象的、带有动态语义的高级程序设计语言。通俗来讲,Python 是一种少有的、既简单又功能强大的编程语言,它注重的是如何...

    毕业设计项目,Python课程设计项目:基于python机器学习的天气预测及可视化,采用随机森林算法+pyecharts实现

    几个CSV文件保存的是爬取后并经过处理的数据 * 天气数据的预测 GetModel文件通过训练预测模型来预测长春近一周的天气,该文件利用Joblib将模型保存到本地 Main文件是项目主文件,通过运行该文件即可运行整个...

    Python人工智能项目开发实战_神经机器翻译_优秀案例实例源代码源码.zip

    它是计算机语言学的一个分支,已经有几年的研究历史。目前在美国,翻译是一个价值400亿美元的产业,而同时在欧洲和亚洲,翻译的市场也在快速增长。翻译在社会、政府、经济等方面都有巨大的商业需求,并被诸如 Google、 ...

    Python项目 | 「Park at ease」停车场管理系统

    「Park at ease」停车场管理系统,基于...原来这个项目都是自己弄着玩的,这几天整理文件发现几个月前还写了这玩意儿,还挺有意思的。 使用及转载时请注明出处,保留作者信息,严禁商用,严禁用于完成课设任务,谢谢!

    大概需要几个月时间开发的python Flask 商城项目.zip

    适合学习/练手、毕业设计、课程设计、期末/期中/大作业、工程实训、相关项目/竞赛学习等。 项目具有较高的学习借鉴价值,也可直接拿来修改复现。可以在这些基础上学习借鉴进行修改和扩展,实现其它功能。 可放心下载...

    Python网络爬虫实战

    本书从Python 3.6.4的安装开始,详细讲解了Python从简单程序延伸到Python网络爬虫的全过程。...胡松涛,高级工程师,参与多个Linux开源项目,github知名代码分享者,活跃于国内著名的多个开源论坛。

    持续集成开源工具

    Sonarqube是一个用于代码质量管理的开源平台,用于管理源代码的质量,可以从七个维度检测代码质量,通过插件形式,可以支持包括java,C#,C/C++,PL/SQL,Cobol,JavaScrip,Groovy等等二十几种编程语言的代码质量管理与...

    仓库管理系统,移动端APP开源项目,支持Android、iOS.zip

    仓库管理系统,移动端APP开源项目,支持Android、iOS,基于.NET(C#、VB)。SmoWMS仓库管理系统包含了仓库管理、订单、主数据维护、图表分析、个人信息等几大功能。 SmoWMS is Warehouse Management solution for AP...

    Python中return self的用法详解

    在Python中,有些开源项目中的方法返回结果为self. 对于不熟悉这种用法的读者来说,这无疑使人困扰,本文的目的就是给出这种语法的一个解释,并且给出几个例子。 在Python中,return self的作用为:(英语原文,笔者...

    Python仿真区块链,适合毕业设计项目或课题研究。汇智网提供.zip

    Python 作为毕业设计的编程语言具有以下几个显著优点: 1. **简单易学**: - Python 语法简洁明了,易于理解和掌握,对于没有太多编程经验的学生来说,能够更快地上手进行项目开发。 2. **高效开发**: - Python...

    python学习入门教程

    Python 是一门开源免费、通用型的脚本编程语言,它...概括起来,Python的应用领域主要有如下几个:web应用开发、自动化运维、人工智能领域、网络爬虫、科学计算、金融领域、游戏开发等。 感兴趣的小伙伴赶快学起来吧。

    仓库管理系统,移动端APP开源项目,支持Android、OS,基于.NET(C#、VB)。.zip

    仓库管理系统,移动端APP开源项目,支持Android、OS,基于.NET(C#、VB)。SmoWMS仓库管理系统包含了仓库管理、订单、主数据维护、图表分析、个人信息等几大功能。 SmoWMS is Warehouse Management solution for AP...

    基于python的企业物流管理系统(django)源码.zip

    本系统具有以下几个特点:(1)灵活性高,可以根据企业的实际需求进行二次开发和定制化;(2)操作简单,用户界面友好,易于使用;(3)响应速度快,系统能够快速响应用户请求并处理任务;(4)安全性高,数据安全...

    Python灰帽子-黑客与逆向工程师的Python编程之道[简体中文版]

    出现在本书中的相当一部分Python代码实例借鉴或直接来源于一些优秀的开源安全项目,诸如Pedram Amini的Paimei,由此读者可以领略到安全研究者们是如何将黑客艺术与工程技术优雅融合来解决那些棘手问题的。...

    基于mindspore框架和GAN实现的漫画脸生成python源码+项目说明+模型.zip

    主要包含以下几个步骤: - 检测人脸及关键点。 - 根据关键点旋转校正人脸。 - 将关键点边界框按固定的比例扩张并裁剪出人脸区域。 - 使用人像分割模型将背景置白,得到统一的图像模式。 ![image-20220625223031715...

Global site tag (gtag.js) - Google Analytics