(转)几个有趣的python开源项目
2009-01-05 12:46
441 查看
一直都对搜索引擎很感兴趣,因此有一个是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.
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
Extract the referencies from a file
The output will be:
Then run to see result:
Almost the same for extract the referencies from files in a directory, except that it will use on all pdf files.
Here is the result of the parsing
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/
Here is the result of the parsing
相关文章推荐
- 几个有趣的python开源项目
- 一些有趣的python开源项目
- 如果你喜欢Python 那么你不得不知的几个开源项目
- 如果你喜欢Python 那么你不得不知的几个开源项目
- 如果你喜欢Python 那么你不得不知的几个开源项目
- 如果你喜欢Python 那么你不得不知的几个开源项目
- python不得不知的几个开源项目
- python不得不知的几个开源项目
- 如果你喜欢Python 那么你不得不知的几个开源项目
- Github上的几个C++开源项目
- 记录创建企业Wiki的几个开源项目
- 最近看到的一些比较有趣的javascript开源项目
- 参与一个Python的开源项目Python-QQ
- 微信几个开源项目参考
- 你用 Python 做过什么有趣的数据挖掘项目
- 以正确的方式开源 Python 项目
- 几个开源项目
- Python:渗透测试开源项目
- 几个常用开源项目的地址荟萃
- 如何学习Python开源项目代码