有没有从 CSV 导入 BibTeX 的工具?

有没有从 CSV 导入 BibTeX 的工具?

我正在寻找一种方法来获取存储在Goodreads,转换为 BibTeX 格式。据我所知,Goodreads 不直接提供此支持,但确实提供了CSV 导出(右侧)。有什么工具可以用来将 CSV 文件导入 BibTeX 吗?


FWIW,goodreads 导出的字段是

Book Id,Title,Author,Author l-f,Additional Authors,ISBN,ISBN13,My Rating,Average Rating,Publisher,Binding,Number of Pages,Year Published,Original Publication Year,Date Read,Date Added,Bookshelves,Bookshelves with positions,Exclusive Shelf,My Review,Spoiler,Private Notes,Read Count,Recommended For,Recommended By,Owned Copies,Original Purchase Date,Original Purchase Location,Condition,Condition Description,BCID

当然,我可以轻松地重新排列它们的顺序或转换为其他分隔符。

答案1

我不会给出完整的答案,但会给出一些建议(必须经过认真努力才能使其完整)。

有以下工具:

问题是xml2bib需要一种非常特殊的格式,称为元数据对象描述架构:MODS

下面,我给出了我的论文.bib参考书目的示例文件,转换为正确的.xml MODS 格式经过bib2xml并转换回.bib文件xml2bib。它说明了 XML 格式是多么复杂:

我很抱歉文件列表太长,但我没有可靠的在线文件存储。

@book{beardon,
    AUTHOR = {Beardon, Alan F.},
     TITLE = {The geometry of discrete groups},
    SERIES = {Graduate Texts in Mathematics},
    VOLUME = {91},
      NOTE = {Corrected reprint of the 1983 original},
 PUBLISHER = {Springer-Verlag},
   ADDRESS = {New York},
      YEAR = {1995},
     PAGES = {xii+337},
      ISBN = {0-387-90788-2},
 XXMRCLASS = {22E40 (11F06 20H15 30F35 57N10)},
XXMRNUMBER = {1393195 (97d:22011)},
}

@article{ford,
    AUTHOR = {Ford, Lester R.},
     TITLE = {The fundamental region for a {F}uchsian group},
   JOURNAL = {Bull. Amer. Math. Soc.},
  FJOURNAL = {Bulletin of the American Mathematical Society},
    VOLUME = {31},
      YEAR = {1925},
    NUMBER = {9-10},
     PAGES = {531--539},
      ISSN = {0002-9904},
 XXMRCLASS = {Contributed Item},
XXMRNUMBER = {1561111},
       DOI = {10.1090/S0002-9904-1925-04104-X},
       URL = {http://dx.doi.org/10.1090/S0002-9904-1925-04104-X},
}

@article{k:sr_rmg,
    AUTHOR = {K{\r{u}}rka, Petr},
     TITLE = {A symbolic representation of the real {M}\"obius group},
   JOURNAL = {Nonlinearity},
  FJOURNAL = {Nonlinearity},
    VOLUME = {21},
      YEAR = {2008},
    NUMBER = {3},
     PAGES = {613--623},
      ISSN = {0951-7715},
     CODEN = {NONLE5},
 XXMRCLASS = {37F30 (37B10)},
XXMRNUMBER = {2396619 (2009j:37073)},
MRREVIEWER = {Jiri Fiser},
       DOI = {10.1088/0951-7715/21/3/012},
       URL = {http://dx.doi.org/10.1088/0951-7715/21/3/012},
}

<?xml version="1.0" encoding="UTF-8"?>
<modsCollection xmlns="http://www.loc.gov/mods/v3">
<mods ID="beardon">
    <titleInfo>
        <title>The geometry of discrete groups</title>
    </titleInfo>
    <name type="personal">
        <namePart type="given">Alan</namePart>
        <namePart type="given">F</namePart>
        <namePart type="family">Beardon</namePart>
        <role>
            <roleTerm authority="marcrelator" type="text">author</roleTerm>
        </role>
    </name>
    <originInfo>
        <issuance>monographic</issuance>
        <dateIssued>1995</dateIssued>
        <publisher>Springer-Verlag</publisher>
        <place>
            <placeTerm type="text">New York</placeTerm>
        </place>
    </originInfo>
    <typeOfResource>text</typeOfResource>
    <genre authority="marcgt">book</genre>
    <relatedItem type="host">
        <titleInfo>
            <title>Graduate Texts in Mathematics</title>
        </titleInfo>
    </relatedItem>
    <note>Corrected reprint of the 1983 original</note>
    <identifier type="isbn">0-387-90788-2</identifier>
    <identifier type="citekey">beardon</identifier>
    <part>
        <detail type="volume"><number>91</number></detail>
    </part>
</mods>
<mods ID="ford">
    <titleInfo>
        <title>The fundamental region for a Fuchsian group</title>
    </titleInfo>
    <name type="personal">
        <namePart type="given">Lester</namePart>
        <namePart type="given">R</namePart>
        <namePart type="family">Ford</namePart>
        <role>
            <roleTerm authority="marcrelator" type="text">author</roleTerm>
        </role>
    </name>
    <originInfo>
        <dateIssued>1925</dateIssued>
    </originInfo>
    <typeOfResource>text</typeOfResource>
    <relatedItem type="host">
        <titleInfo>
            <title>Bull. Amer. Math. Soc.</title>
        </titleInfo>
        <originInfo>
            <issuance>continuing</issuance>
        </originInfo>
        <genre authority="marcgt">periodical</genre>
        <genre>academic journal</genre>
        <identifier type="issn">0002-9904</identifier>
    </relatedItem>
    <identifier type="citekey">ford</identifier>
    <identifier type="doi">10.1090/S0002-9904-1925-04104-X</identifier>
    <location>
        <url>http://dx.doi.org/10.1090/S0002-9904-1925-04104-X</url>
    </location>
    <part>
        <date>1925</date>
        <detail type="volume"><number>31</number></detail>
        <detail type="number"><number>9-10</number></detail>
        <extent unit="page">
            <start>531</start>
            <end>539</end>
        </extent>
    </part>
</mods>
<mods ID="k:sr_rmg">
    <titleInfo>
        <title>A symbolic representation of the real Möbius group</title>
    </titleInfo>
    <name type="personal">
        <namePart type="given">Petr</namePart>
        <namePart type="family">K\rurka</namePart>
        <role>
            <roleTerm authority="marcrelator" type="text">author</roleTerm>
        </role>
    </name>
    <originInfo>
        <dateIssued>2008</dateIssued>
    </originInfo>
    <typeOfResource>text</typeOfResource>
    <relatedItem type="host">
        <titleInfo>
            <title>Nonlinearity</title>
        </titleInfo>
        <originInfo>
            <issuance>continuing</issuance>
        </originInfo>
        <genre authority="marcgt">periodical</genre>
        <genre>academic journal</genre>
        <identifier type="issn">0951-7715</identifier>
    </relatedItem>
    <identifier type="citekey">k:sr_rmg</identifier>
    <identifier type="doi">10.1088/0951-7715/21/3/012</identifier>
    <location>
        <url>http://dx.doi.org/10.1088/0951-7715/21/3/012</url>
    </location>
    <part>
        <date>2008</date>
        <detail type="volume"><number>21</number></detail>
        <detail type="number"><number>3</number></detail>
        <extent unit="page">
            <start>613</start>
            <end>623</end>
        </extent>
    </part>
</mods>
</modsCollection>

@Book{beardon,
author="Beardon, Alan F.",
title="The geometry of discrete groups",
series="Graduate Texts in Mathematics",
year="1995",
publisher="Springer-Verlag",
address="New York",
volume="91",
note="Corrected reprint of the 1983 original",
isbn="0-387-90788-2"
}

@Article{ford,
author="Ford, Lester R.",
title="The fundamental region for a Fuchsian group",
journal="Bull. Amer. Math. Soc.",
year="1925",
volume="31",
number="9-10",
pages="531--539",
issn="0002-9904",
doi="10.1090/S0002-9904-1925-04104-X",
url="http://dx.doi.org/10.1090/S0002-9904-1925-04104-X"
}

@Article{k:sr_rmg,
author="K{\backslash}rurka, Petr",
title="A symbolic representation of the real M{\"o}bius group",
journal="Nonlinearity",
year="2008",
volume="21",
number="3",
pages="613--623",
issn="0951-7715",
doi="10.1088/0951-7715/21/3/012",
url="http://dx.doi.org/10.1088/0951-7715/21/3/012"
}

现在:以下是一个带有标题和一个参考书目项目的输入文件(每个字段包含带有abc...xyz虚拟文本的文件名)。我相信输出 XML 文件可以转换为MODS 格式,但我不确定怎么做,而且会有很多工作。我想到的原因就是将表单的每个字符串替换<Title>为正确格式的标题前的 XML 标记字符串。

Book Id,Title,Author,Author l-f,Additional Authors,ISBN,ISBN13,My Rating,Average Rating,Publisher,Binding,Number of Pages,Year Published,Original Publication Year,Date Read,Date Added,Bookshelves,Bookshelves with positions,Exclusive Shelf,My Review,Spoiler,Private Notes,Read Count,Recommended For,Recommended By,Owned Copies,Original Purchase Date,Original Purchase Location,Condition,Condition Description,BCID
abcBook Idxyz,abcTitlexyz,abcAuthorxyz,abcAuthor l-fxyz,abcAdditional Authorsxyz,abcISBNxyz,abcISBN13xyz,abcMy Ratingxyz,abcAverage Ratingxyz,abcPublisherxyz,abcBindingxyz,abcNumber of Pagesxyz,abcYear Publishedxyz,abcOriginal Publication Yearxyz,abcDate Readxyz,abcDate Addedxyz,abcBookshelvesxyz,abcBookshelves with positionsxyz,abcExclusive Shelfxyz,abcMy Reviewxyz,abcSpoilerxyz,abcPrivate Notesxyz,abcRead Countxyz,abcRecommended 

<row>
  <Book_Id>abcBook Idxyz</Book_Id>
  <Title>abcTitlexyz</Title>
  <Author>abcAuthorxyz</Author>
  <Author_l_f>abcAuthor l-fxyz</Author_l_f>
  <Additional_Authors>abcAdditional Authorsxyz</Additional_Authors>
  <ISBN>abcISBNxyz</ISBN>
  <ISBN13>abcISBN13xyz</ISBN13>
  <My_Rating>abcMy Ratingxyz</My_Rating>
  <Average_Rating>abcAverage Ratingxyz</Average_Rating>
  <Publisher>abcPublisherxyz</Publisher>
  <Binding>abcBindingxyz</Binding>
  <Number_of_Pages>abcNumber of Pagesxyz</Number_of_Pages>
  <Year_Published>abcYear Publishedxyz</Year_Published>
  <Original_Publication_Year>abcOriginal Publication Yearxyz</Original_Publication_Year>
  <Date_Read>abcDate Readxyz</Date_Read>
  <Date_Added>abcDate Addedxyz</Date_Added>
  <Bookshelves>abcBookshelvesxyz</Bookshelves>
  <Bookshelves_with_positions>abcBookshelves with positionsxyz</Bookshelves_with_positions>
  <Exclusive_Shelf>abcExclusive Shelfxyz</Exclusive_Shelf>
  <My_Review>abcMy Reviewxyz</My_Review>
  <Spoiler>abcSpoilerxyz</Spoiler>
  <Private_Notes>abcPrivate Notesxyz</Private_Notes>
  <Read_Count>abcRead Countxyz</Read_Count>
  <Recommended_For>abcRecommended Forxyz</Recommended_For>
  <Recommended_By>abcRecommended Byxyz</Recommended_By>
  <Owned_Copies>abcOwned Copiesxyz</Owned_Copies>
  <Original_Purchase_Date>abcOriginal Purchase Datexyz</Original_Purchase_Date>
  <Original_Purchase_Location>abcOriginal Purchase Locationxyz</Original_Purchase_Location>
  <Condition>abcConditionxyz</Condition>
  <Condition_Description>abcCondition Descriptionxyz</Condition_Description>
  <BCID>abcBCIDxyz</BCID>
</row>

答案2

佐特罗
我没有用过Goodreads,但我建议你试试佐特罗,看看 Zotero 是否可以直接导入。也许它可以在一次操作中直接获取您的所有书籍。Zotero 独立版适用于不同的浏览器和不同的平台。

尝试一下吧,它是免费的,所以你不会浪费任何钱。

MarcEdit + Bibutils
两步解决方案是使用Marc编辑:您可以导入分隔文件(例如CSV) 格式。然后只需将其保存为 .bib 文件管理器支持的任何合适格式即可。如果您需要清理或操作 CSV 文件,您可以使用 Sam Franche 的已 CSV

完整的解决方案: 将 CSV 文件导入MarcEdit。另存为MODS-file。然后,您可以使用bibutils将 MODS 格式转换为 bibtex,如建议的那样托黑茨

您还可以将从 MarcEdit 导出的 MODS 文件导入 Zotero,清理它并将其导出为bibtex格式。

贾布雷夫
贾布雷夫可以导入多种格式,但我不能完全确定其中任何一种都可以从 MarcEdit 导出。JabRef也可以从 SQL 数据库(MySQL 等)读取。您可以将 CSV 文件导入 MySQL 表,让 JabRef 导入它并将其导出为 .bib 文件。

答案3

由于 CSV 文件中每本书都有一个 ISBN,而且我需要的所有 BibTeX 信息都可以根据 ISBN 重建,我需要做的就是使用 CSV 中的 ISBN 列创建一个数组,然后生成一个包含相应 BibTeX 信息的文件:

#!/bin/bash
#Generate a BibTeX bibliography from an array of ISBNs

array=(<pasted column of ISBNs>)

rm goodreads.bib
for isbn in "${isbnarray[@]}"
do
    curl http://manas.tungare.name/software/isbn-to-bibtex/isbn-service?isbn=$isbn >> goodreads.bib
done

就是这样。

答案4

我有最简单的解决方案,我认为更值得信赖。在https://doi.org/您已注册所有 DOI,网站只返回 bib 格式。如果您访问https://doi.org/$doi,您将获得所有相关信息。

因此,您可以按如下方式使用:

doi="10.1007/978-3-319-46031-4_16"
curl -LH "Accept: application/x-bibtex; charset=utf-8" https://doi.org/$doi

您将获得:

@incollection{Solberg_2016,
    doi = {10.1007/978-3-319-46031-4_16},
    url = {https://doi.org/10.1007%2F978-3-319-46031-4_16},
    year = 2016,
    month = {dec},
    publisher = {Springer International Publishing},
    pages = {147--149},
    author = {Arnor Solberg and Peter Matthews},
    title = {Conclusion and Future Research},
    booktitle = {Model-Driven Development and Operation of Multi-Cloud Applications}
}

在我的例子中,我需要转换,因为 Springer 没有 bib 格式可供导出。因此我导出为 CSV,分离 DOI 列并保存在名为 doi.txt 的文件中(每行 1 个 DOI),然后我创建了一个最简单的脚本。

for doi in `cat doi.txt`
    do echo "Downloading line > $doi"
    curl -LH "Accept: application/x-bibtex; charset=utf-8" https://doi.org/$doi >> result.bib;
done

相关内容