如何将大型XML文件转换并流式传输到postgres?Mediawiki转储日志

2024-05-15 10:29:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在现有最大的公共自然语言语料库上使用postgres的全文搜索。我下载了几个MEG中的wikimedia dump stub作为示例,目标是进一步使用dumps around 70GB uncompressedHere is the xsd。 我知道还有其他的open parallel corpora更容易使用,我想在这里集中讨论维基媒体

这似乎是重复的,但与我发现的其他建议相比,我想研究一种更简单的方法:postgres mailing list and lopostgres mailing list and jshere with pg_read_filehere with nodejshere with splittinghere with splitting + csv

我想在进入postgres之前对xml进行预处理,并使用复制命令对其进行流式处理BaseX允许使用命令行和xpath将xml序列化为csv/文本。我已经有一些博士后了

XML中的文本标记包含巨大的文本块,wikitext中的wikipedia文章内容,这些内容很难放入csv(引号、双引号、换行符+所有wikitext奇怪的语法),所以我想知道格式。理想情况下,我想要一条小溪,目前正在考虑:

basex [-xpath command] | psql -c 'COPY foo FROM stdin (format ??)'

下面是我的问题:basex能否处理xml输入,并以流而不是批处理的方式输出转换?如果是,我可以使用什么输出格式加载到postgres

我打算最终将数据存储在the mediawiki postgresql schema (at the bottom of the link)中,但我将处理一个没有索引、没有触发器的玩具模式。。。第一 The problem of wikitext remains, but that's another story


Tags: andcsvthe文本here格式withpostgres