将 Wikipedia 引文转换为 BibTeX

将 Wikipedia 引文转换为 BibTeX

我写了一个维基百科页面有超过 20 个参考文献。现在,我想总结一下我写的某篇论文的相关工作部分。问题是该页面中的参考文献在 Wikipedia 模板中。有没有办法从这些引用模板自动生成 BibTeX 记录?

答案1

Markdown 在文本中嵌入了一堆形式的引用

<ref>{{Cite arXiv |eprint=2305.11406 |last1=Budish |first1=Eric |last2=Gao |
   first2=Ruiquan |last3=Othman |first3=Abraham |last4=Rubinstein |first4=Aviad |last5=Zhang
   |first5=Qianfan |title=Practical algorithms and experimentally validated incentives
    for equilibrium-based fair division (A-CEEI) |year=2023 |class=cs.GT }}</ref>

这是,模数使用|而不是{...},{...}分隔字段,或多或少是 bibtex,所以您只需要提取所有这些子字符串并更改|},{(以及进一步清理)。

以下内容可以更加努力地使用标准 bibtex 字段名称并从作者姓名或标题生成引用键,而不仅仅是ref1,,ref2..但它只有 30 行 perl 并且已经生成一个合理的 bibtex 文件。

用于perl wiki1.pl yourfile.md > yourfile.bib


perl:

open my $fh, '<', $ARGV[0] or die "Can't open file $!";

read $fh, my $file_content, -s $fh;

my $num=0;

while ($file_content =~ m/<ref[^<]*<\/ref>/mg) {
    $num =$num+1;
    $_=$&;
    s/<ref[^{}]*>\{\{Cite book/\n\n\@book\{ref$num/;
    s/<ref[^{}]*>\{\{Cite journal/\n\n\@article\{ref$num/;
    s/<ref[^{}]*>\{\{Cite arXiv/\n\n\@article\{ref$num/;
    s/<ref[^{}]*>\{\{Cite web/\n\n\@misc\{ref$num/;
    s/<ref[^{}]*>\{\{Cite [a-zA-Z]+/\n\n\@misc\{ref$num/;

    s/\|last1?=/\},\n  author=/;
    s/\|last[0-9]+=/ and /g;
    s/\|first[0-9]*=/, /g;


    s/\|editor1?-last=/\},\n  editor=/;
    s/\|editor[0-9]+-last=/ and /g;
    s/\|editor[0-9]*-first=/, /g;
    
    s/\ *\| */\},\n  /g;
    s/(  [a-zA-Z0-9\-]+=)/\1\{/g;

    s/(\{ref[0-9]+) *\},/\1,/g;

    s/\}\}<\/ref>/\}\n\}/g;
     print "$_";
}

print "\n";

从问题链接的 markdown 生成 bib。



@book{ref1,
  author={Kominers, Scott Duke and Ruberry, Mike and Ullman, Jonathan},
  title={Internet and Network Economics},
  chapter={Course Allocation by Proxy Auction},
  date={2010},
  editor={Saberi, Amin},
  chapter-url={https://link.springer.com/chapter/10.1007/978-3-642-17572-5_49},
  series={Lecture Notes in Computer Science},
  volume={6484},
  language={en},
  location={Berlin, Heidelberg},
  publisher={Springer},
  pages={551–558},
  doi={10.1007/978-3-642-17572-5_49},
  isbn={978-3-642-17572-5}
}

@article{ref2,
  author={Budish, Eric and Cantillon, Estelle},
  date={2007},
  editor={Cramton, Peter and Müller, Rudolf and Tardos, Eva and Tennenholtz, Moshe},
  title={Strategic Behavior in Multi-unit Assignment Problems: Theory and Evidence from Course Allocations},
  url={http://drops.dagstuhl.de/opus/volltexte/2007/1154},
  journal={Computational Social Systems and the Internet},
  series={Dagstuhl Seminar Proceedings},
  volume={7271},
  pages={1},
  location={Dagstuhl, Germany},
  publisher={Internationales Begegnungs- und Forschungszentrum für Informatik (IBFI), Schloss Dagstuhl, Germany},
  doi={10.4230/DagSemProc.07271.15 }
}

@article{ref3,
  author={Budish, Eric and Cantillon, Estelle},
  date={2012-08-01},
  title={The Multi-unit Assignment Problem: Theory and Evidence from Course Allocation at Harvard},
  url={https://www.aeaweb.org/articles?id=10.1257/aer.102.5.2237},
  journal={American Economic Review},
  language={en},
  volume={102},
  issue={5},
  pages={2237–2271},
  doi={10.1257/aer.102.5.2237},
  s2cid={5132273},
  issn={0002-8282}
}

@article{ref4,
  author={Hoshino, Richard and Raible-Clark, Caleb},
  title={The Quest Draft: An Automated Course Allocation Algorithm},
  journal={Proceedings of the AAAI Conference on Artificial Intelligence},
  date={2014-07-27},
  url={https://dl.acm.org/doi/abs/10.5555/2892753.2892954},
  series={AAAI'14},
  volume={28},
  issue={2},
  location={Québec City, Québec, Canada},
  publisher={AAAI Press},
  pages={2906–2913},
  doi={10.1609/aaai.v28i2.19025},
  s2cid={14197118 }
}

@article{ref5,
  author={Li, Mengling},
  date={2020-10-01},
  title={Ties matter: Improving efficiency in course allocation by allowing ties},
  url={http://www.sciencedirect.com/science/article/pii/S0167268120302523},
  journal={Journal of Economic Behavior & Organization},
  language={en},
  volume={178},
  pages={354–384},
  doi={10.1016/j.jebo.2020.07.030},
  s2cid={225044860},
  issn={0167-2681}
}

@article{ref6,
  author={Pápai, Szilvia},
  date={2001},
  title={Strategyproof and Nonbossy Multiple Assignments},
  url={https://www.onlinelibrary.wiley.com/doi/abs/10.1111/1097-3923.00066},
  journal={Journal of Public Economic Theory},
  language={en},
  volume={3},
  issue={3},
  pages={257–271},
  doi={10.1111/1097-3923.00066},
  issn={1467-9779}
}

@article{ref7,
  author={Ehlers, Lars and Klaus, Bettina},
  date={2003},
  title={Coalitional strategy-proof and resource-monotonic solutions for multiple assignment problems},
  url={https://www.jstor.org/stable/41106560},
  journal={Social Choice and Welfare},
  volume={21},
  issue={2},
  pages={265–280},
  doi={10.1007/s00355-003-0259-1},
  jstor={41106560},
  s2cid={8455104},
  issn={0176-1714}
}

@article{ref8,
  author={Hatfield, John William},
  date={2009-09-01},
  title={Strategy-proof, efficient, and nonbossy quota allocations},
  url={https://doi.org/10.1007/s00355-009-0376-6},
  journal={Social Choice and Welfare},
  language={en},
  volume={33},
  issue={3},
  pages={505–515},
  doi={10.1007/s00355-009-0376-6},
  s2cid={7713320},
  issn={1432-217X}
}

@article{ref9,
  author={Sönmez, Tayfun and Ünver, M. Utku},
  date={2010},
  title={Course Bidding at Business Schools*},
  url={https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1468-2354.2009.00572.x},
  journal={International Economic Review},
  language={en},
  volume={51},
  issue={1},
  pages={99–123},
  doi={10.1111/j.1468-2354.2009.00572.x},
  s2cid={154573224},
  issn={1468-2354}
}

@misc{ref10,
  date={2020-06-15},
  title={Tel-Aviv University registration instructions (in Hebrew)},
  url={https://education.tau.ac.il/rishum_toar_rishon}
}

@article{ref11,
  author={Budish, Eric},
  date={2011-12-01},
  title={The Combinatorial Assignment Problem: Approximate Competitive Equilibrium from Equal Incomes},
  url={https://www.journals.uchicago.edu/doi/full/10.1086/664613},
  journal={Journal of Political Economy},
  volume={119},
  issue={6},
  pages={1061–1103},
  doi={10.1086/664613},
  s2cid={1161325},
  issn={0022-3808}
}

@article{ref12,
  author={Othman, Abraham and Sandholm, Tuomas and Budish, Eric},
  date={2010-05-10},
  title={Finding approximate competitive equilibria: efficient and fair course allocation},
  url={https://dl.acm.org/doi/abs/10.5555/1838206.1838323},
  journal={Proceedings of the 9th International Conference on Autonomous Agents and Multiagent Systems: Volume 1},
  series={AAMAS '10},
  location={Toronto, Canada},
  publisher={International Foundation for Autonomous Agents and Multiagent Systems},
  pages={873–880},
  isbn={978-0-9826571-1-9}
}

@article{ref13,
  author={Budish, Eric and Cachon, Gérard P. and Kessler, Judd B. and Othman, Abraham},
  date={2016-10-28},
  title={Course Match: A Large-Scale Implementation of Approximate Competitive Equilibrium from Equal Incomes for Combinatorial Allocation},
  journal={Operations Research},
  volume={65},
  issue={2},
  pages={314–336},
  doi={10.1287/opre.2016.1544},
  issn={0030-364X},
  doi-access={free}
}

@misc{ref14,
  title={Course Match is the fairest course registration platform in higher education},
  url={https://www.cognomos.com/},
  access-date={2023-06-14},
  website={www.cognomos.com},
  language={en}
}

@article{ref15,
  eprint={2305.11406 },
  author={Budish , Eric  and Gao , Ruiquan  and Othman , Abraham  and Rubinstein , Aviad  and Zhang , Qianfan},
  title={Practical algorithms and experimentally validated incentives for equilibrium-based fair division (A-CEEI)},
  year={2023},
  class={cs.GT }
}

@article{ref16,
  author={Budish, Eric and Kessler, Judd B.},
  date={2016-07-25},
  title={Can Market Participants Report their Preferences Accurately (Enough)?},
  series={Working Paper Series},
  doi={10.3386/w22448},
  url={https://www.nber.org/papers/w22448},
  language={en}
}

@article{ref17,
  author={Budish, Eric B. and Kessler, Judd B.},
  date={2017-11-12},
  title={Can Agents 'Report Their Types'? An Experiment that Changed the Course Allocation Mechanism at Wharton},
  url={https://papers.ssrn.com/abstract=2579107},
  language={en},
  location={Rochester, NY},
  doi={10.2139/ssrn.2579107},
  ssrn={2579107},
  s2cid={109825489 }
}

@article{ref18,
  author={Budish, Eric and Che, Yeon-Koo and Kojima, Fuhito and Milgrom, Paul},
  date={2013-04-01},
  title={Designing Random Allocation Mechanisms: Theory and Applications},
  url={https://www.aeaweb.org/articles?id=10.1257/aer.103.2.585},
  journal={American Economic Review},
  language={en},
  volume={103},
  issue={2},
  pages={585–623},
  doi={10.1257/aer.103.2.585},
  issn={0002-8282}
}

@article{ref19,
  author={Diebold, Franz and Aziz, Haris and Bichler, Martin and Matthes, Florian and Schneider, Alexander},
  date={2014-04-01},
  title={Course Allocation via Stable Matching},
  url={https://doi.org/10.1007/s12599-014-0316-6},
  journal={Business & Information Systems Engineering},
  language={en},
  volume={6},
  issue={2},
  pages={97–110},
  doi={10.1007/s12599-014-0316-6},
  s2cid={493430},
  issn={1867-0202}
}

@article{ref20,
  author={Budish, Eric},
  date={2012-12-01},
  title={Matching "versus" mechanism design},
  url={https://doi.org/10.1145/2509002.2509005},
  journal={ACM SIGecom Exchanges},
  volume={11},
  issue={2},
  pages={4–15},
  doi={10.1145/2509002.2509005},
  s2cid={5938165 }
}

@article{ref21,
  author={Diebold, Franz and Bichler, Martin},
  date={2017-07-01},
  title={Matching with indifferences: A comparison of algorithms in the context of course allocation},
  url={http://www.sciencedirect.com/science/article/pii/S037722171631030X},
  journal={European Journal of Operational Research},
  language={en},
  volume={260},
  issue={1},
  pages={268–282},
  doi={10.1016/j.ejor.2016.12.011},
  issn={0377-2217}
}

@article{ref22,
  author={Atef Yekta, Hoda and Day, Robert},
  date={2020-01-13},
  title={Optimization-based Mechanisms for the Course Allocation Problem},
  url={https://pubsonline.informs.org/doi/abs/10.1287/ijoc.2018.0849},
  journal={INFORMS Journal on Computing},
  volume={32},
  issue={3},
  pages={641–660},
  doi={10.1287/ijoc.2018.0849},
  s2cid={213466767},
  issn={1091-9856}
}

相关内容