`
javayestome
  • 浏览: 1029128 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

(转)几个有趣的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-所有语言中真正有趣的开源项目真正的大列表

    标题“Python-所有语言中真正有趣的开源项目真正的大列表”揭示了这个压缩包可能包含一个详尽的Python开源项目集合,而描述中的“所有语言中真正有趣的开源项目,真正的大列表”则暗示这份资源不仅限于Python,也...

    pygis-bukun_地图_pythongis_Python与开源GIS_python开源gis应用_python地图_

    本资料主要涵盖了以下几个关键知识点: 1. **Python基础知识**:Python作为一门易于学习且功能强大的编程语言,是GIS开发者的首选。它具有清晰的语法,丰富的库支持,并且能够高效地处理大量数据。 2. **GIS概念**...

    Python开源的Web框架Django.zip

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

    Python-开源协议说明

    本篇文章将深入探讨Python开源协议的相关知识。 首先,我们需要了解什么是开源协议。开源协议(Open Source Licenses)是一系列法律文件,它们规定了开源软件的使用、修改、复制和分发的条件。这些协议保障了开源...

    几个开源的ChatGPT项目.zip

    项目的实现通常分为几个关键步骤:数据预处理、模型架构、训练和评估。数据预处理涉及收集大规模文本数据,进行清洗、分词和编码;模型架构部分则需要设计与ChatGPT类似的Transformer模型,可能包括自注意力机制、...

    分布式综合智慧能源系统模型python源码

    总的来说,这个开源项目为学习和实践分布式智慧能源系统提供了宝贵的实践平台,不仅可以提升Python编程技能,也能深入理解和应用能源管理系统的关键技术。通过研究源码,我们可以了解实际项目中的设计思路,进一步...

    Python-一个基于Django博客系统

    通常,一个Django项目会包含以下几个关键文件和目录: 1. `manage.py` - Django项目的命令行工具,用于运行服务器、迁移数据库等操作。 2. `requirements.txt` - 列出项目所依赖的Python库及其版本。 3. `settings....

    开源项目-ncw-gpython.zip

    开源项目“ncw-gpython.zip”是一个基于Go语言实现Python解释器的独特尝试。这个项目的主要目标是让开发者能够在Go环境中运行Python代码,从而利用Python的丰富库和语法特性,同时受益于Go语言的高效性能和并发能力...

    Python-李笑来的Python学习内容开源的

    在这个开源项目中,李笑来可能会涵盖以下几个重要的Python知识点: 1. **基础语法**:Python的基础包括变量、数据类型(如整型、浮点型、字符串、布尔型)、运算符、控制结构(如if-else、for、while循环)以及函数...

    开源PLC beremiz Python源码

    在使用"开源PLC beremiz Python源码"时,首先需要熟悉以下几个关键知识点: 1. **Python编程**:Beremiz的核心是Python语言,因此理解Python基础语法、数据结构、控制流和函数是必不可少的。Python以其简洁易读的...

    python开源切图工具.zip

    本文将深入探讨Python开源切图工具的原理、使用方法以及推荐的几款实用工具。 1. 切图原理: 切图的原理主要是通过编程的方式,定义切割规则(如宽度、高度、起始位置等),然后对源图像进行处理,按照预设规则将...

    几个开源的电影管理系统开源 几个开源的电影管理系统开源 几个开源的电影管理系统开源

    下面我们将详细探讨几个开源的电影管理系统及其特点。 1. **Cinemasuite** Cinemasuite是一款功能丰富的电影管理系统,支持影片资料管理、放映时间表安排、在线售票以及会员管理等功能。它的用户界面友好,易于...

    开源项目-noypi-future.zip

    开源项目“noypi-future.zip”是一个基于Golang语言实现的未来(Futures)库,旨在为Go编程提供一种异步编程模型。Futures是计算机科学中的一个概念,它代表了一个异步计算的结果,允许程序员在计算完成之前进行操作。...

    新闻开源项目

    在IT领域,这样的项目通常涉及到以下几个关键知识点: 1. **Web抓取**:为了收集新闻数据,项目可能使用了Web抓取技术,如Python的BeautifulSoup或Scrapy框架,从新闻网站上自动提取信息。 2. **API接口**:部分...

    python的知网caj格式转pdf

    Python中的`caj2pdf`是一个开源项目,用于解决CAJ到PDF的转换问题。这个工具的核心是利用Python的库和模块,如`PyPDF2`来解析和重组PDF文件。`PyPDF2`是一个纯Python库,用于读取、操作和写入PDF文件,提供了丰富的...

    基于pythonweb的开源项目,使用flask框架实现一个简单的豆瓣评分页面

    这通常意味着项目会涉及到以下几个方面: 1. **Flask框架的使用**:开发者将利用Flask的基本结构,包括定义路由、创建视图函数、以及可能的模板渲染,来设计这个网页。 2. **HTTP请求处理**:Flask通过处理用户的...

Global site tag (gtag.js) - Google Analytics