从维基百科数据库转储生成纯文本 [英] Generating plain text from a Wikipedia database dump

查看:240
本文介绍了从维基百科数据库转储生成纯文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了一个Python脚本(此处:Wikipedia Extractor ),可以从(English)Wikipedia数据库转储
当我使用这个命令(如脚本页面上所述):

I found a Python script (here: Wikipedia Extractor) that can generate plain text from (English) Wikipedia database dump. When I use this command (as it's stated on the script's page):

$ python enwiki-latest-pages-articles.xml WikiExtractor.py -b 500K -o extracted

我收到此错误:


文件enwiki-latest-pages-article.xml,第1行
< mediawiki xmlns =http://www.mediawiki.org/xml/export-0.8/xmlns:xsi =http://www.w3.org/2001/XMLSchema-instancexsi:schemaLocation =http:/ /www.mediawiki.org/xml/export-0.8/http://www.mediawiki.org/xml/export-0.8.xsdversion =0.8xml:lang =en>

File "enwiki-latest-pages-articles.xml", line 1 < mediawiki xmlns="http://www.mediawiki.org/xml/export-0.8/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.8/http://www.mediawiki.org/xml/export-0.8.xsd" version="0.8" xml:lang="en">



^
SyntaxError: invalid syntax

我正在使用Python 2.7.6& Cygwin在Windows 7上。

I'm executing the script using Python 2.7.6 & Cygwin on Windows 7.

我希望如果任何人已经使用这个脚本或使用Python的经验可以帮助我解决这个错误。

I hope If anyone has already used this script or experience with Python can help me to solve this error.

提前感谢!

推荐答案

python 应该是脚本名称。

您可能需要交换 xml py 文件名:

You probably need to swap xml and py file names:

$ python WikiExtractor.py enwiki-latest-pages-articles.xml -b 500K -o extracted

这篇关于从维基百科数据库转储生成纯文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆