gpt4 book ai didi

python - 如何使用 Python 解析以 MARC21 格式存储的文档

转载 作者:太空狗 更新时间:2023-10-29 22:08:18 25 4
gpt4 key购买 nike

昨天 harvard released 开放访问其所有图书馆元数据(约 1200 万条记录)

我希望解析数据并使用它,因为发布的目标是“支持创新”

下载 12GB 的 tarball,解压后找到 13 个 .mrc 文件,每个大约 800MB

MARC21 format

当我查看前几个文件的头部和尾部时,即使在阅读了一些有关 MARC21 的内容之后,它看起来也非常松散。

第一个文件的前 4k 长这样:

$ head -c 4000 ab.bib.00.20120331.full.mrc

00857nam a2200253 a 4500001001200000005001700012008004100029010001700070020001200087035001600099040001800115043001200133050002500145245011100170260004900281300002100330504004100351610006400392650005300456650003500509700003800544988001300582906000800595002000001-420020606093309.7880822s1985    unr      b    000 0 ruso   a   86231326   c0.45rub0 aocm18463285  aDLCcDLCdHLS  ae-ur-un0 aJN6639.A8bK665 198500aInformat︠s︡ii︠a︡ v rabote partiĭnykh komitetov /c[sostavitelʹ Stepan Ivanovich I︠A︡lovega].  aKiev :bIzd-vo polit. lit-ry Ukrainy,c1985.  a206 p. ;c20 cm.  aIncludes bibliographical references.20aKomunistychna partii︠a︡ UkraïnyxInformation services. 0aParty committeeszUkrainexInformation services. 0aInformation serviceszUkraine.1 aI︠A︡lovega, Stepan Ivanovich.  a20020608  0DLC00418nam a22001335u 4500001001200000005001700012008004100029110003000070245004600100260006000146500005800206988001300264906000700277002000002-220020606093309.7900925|1944    mx           |||||||spa|d1 aCampeche (Mexico : State)10aLey del notariado del estado de Campeche.0 a[Campeche]bDepartamento de prensa y publicidad,c1944.  aAt head of title: Gobierno constitucional del estado.  a20020608  0MH00647nam a2200229M  4500001001200000005001700012008004100029010001700070035001600087040001300103041001100116050003600127100004200163245004100205246005600246260001600302300001900318500001500337650004400352988001300396906000800409002000003-020051201172535.0890331s1902    xx       d    000 0 ota    a   73960310 0 aocm23499219  aDLCcEYM0 aotaara0 aPJ6636.T8bU5 1973 (Orien Arab)1 aUnsī, Muḥammad ʻAlī ibn Ḥasan.10aQāmūs al-lughah al-ʻUthmānīyah.3 aDarārī al-lāmiʻāt fī muntakhabāt al-lughāt.  c[1902 1973]  a564 p.c22 cm.  aRomanized. 0aTurkish languagevDictionariesxArabic.  a20020608  0DLC00878nam a2200253 a 4500001001200000005001700012008004100029010001700070035001600087040001800103043001200121050002300133245012800156246004600284260006300330300004800393500003300441610003200474650005000506700002400556710002300580988001300603906000800616002000004-920020606093309.7880404s1980    yu fa         000 0 scco   a   82167322 0 aocm17880048  aDLCcDLCdHLS  ae-yu---0 aL53.P783bT75 198000aTrideset pet godina Prosvetnog pregleda, 1945-1980 /c[glavni i odgovorni urednik i urednik publikacije Ružica Petrović].3 a35 godina Prosvetnog pregleda, 1945-1980.  aBeograd :bNovinska organizacija Prosvetni pregled,c1980.  a146 p., [21] p. of plates :bill. ;c29 cm.  aIn Serbo-Croatian (Cyrillic)20aProsvetni pregledxHistory. 0aEducationzYugoslaviaxHistoryy20th century.1 aPetrović, Ružica.2 aProsvetni pregled.  a20020608  0DLC00449nam a22001455u 4500001001200000005001700012008004100029245008200070260002800152300001100180440006600191700002600257988001300283906000700296002000005-720020606093309.7900925|1981    pl           |||||||pol|d10aZ zagadnień dialektyki i świadomości społecznej /cpod red. K. Ślęczka.0 aKatowice :bUŚ,c1981.  a135 p. 0aPrace naukowe Uniwersytetu Śląskiego w Katowicach ;vnr 4621 aŚlęczka, Kazimierz.  a20020608  0MH00331nam a22001455u 4500001001200000005001700012008004100029100002200070245002200092250001200114260002800126300001100154988001300165906000700178002000006-520020606093309.7900925|1980    pl           |||||||pol|d1 aMencwel, Andrzej.10aWidziane z dołu.  aWyd. 1.0 aWarszawa :bPIW,c1980.  a166 p.  a20020608  0MH00746cam a2200241 a 4500001001200000005001700012008004100029010001700070020001500087035001600102040001800118050002400136082001600160100001600176245008000192260007100272300002500343504004100368650003400409650004000443988001300483906000800496002000007-300000000000000.0900123s1990    enk      b    001 0 eng    a   90031350   a03910368230 aocm21081069  aDLCcDLCdHBS00aHF5439.8b.O35 199

有没有人曾经使用过 MARC21?它通常看起来像这样还是我需要以不同的方式解析它。

最佳答案

pymarc是使用 Python 解析 MARC21 记录的最佳选择(完全披露:我是它的维护者之一)。如果您不熟悉使用 MARC21,则值得阅读您在国会图书馆网站上链接到的一些规范。我还通读了 Working with MARC Code4lib wiki 上的页面。

关于python - 如何使用 Python 解析以 MARC21 格式存储的文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10325895/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com