当前位置:首页 > 使用样例 > 参考文献

为中文参考文献自动添加排序用的拼音信息域
上传时间:2021-05-24 21:02:38
  • 为中文参考文献自动添加排序用的拼音信息域
作品简介

为中文参考文献自动添加排序用的拼音信息域

在非顺序编码要求的参考文献排版中,常常需要在文献表中对参考文献进行排序,而对于中文参考文献,作者的拼音是常用的排序依据。然而在我们下载的bib条目信息中,通常是不会带有拼音的,所以要添加拼音需要个人手动来做,如果参考文献量较大,那么对于个人来说是一个大的负担,本文就是来解决这个问题的。

引言

参考文献生成目前主要是两类方法,一类是基于bibtex的传统方法,这种方法如果要根据拼音对中文文献排序,目前的解决方案是必须要添加key域,包含作者的拼音信息。第二类是基于biblatex的方法,这种方法可以自动根据中文的本地化信息来进行排序,通常情况下是不要添加key域信息的,但也有一些corner case,比如多音字,如果biblatex使用的biber加载的perl模块中的多音字的信息不是通常姓名中的音,那么就需要手动的添加key域,而一旦部分需要添加,那么全部的中文文献都需要添加。因此,目前的情况是,如果要对中文文献排序,如果使用bibtex使用则必须添加,使用biblatex在出现多音字错误的时候必须添加。

那么如何来自动的添加拼音信息呢?我认为这是通过文本的自动处理工具能够解决的。如果参考文献的管理工具能够有这个功能,那么是很自然的可以实现的,可惜的是我映象中好像还没有(我也好久没有了解了,如果有误请指出)。所以我们需要一个额外的工具来处理它。

两年多前我本人写了bibmap程序(见 !(bibmap)[https://github.com/hushidong/biblatex-map]), 目的其实就是用来处理bib文件的,有两种功能:一是参考文献生成,可以替代bibtex工具,二是bib文件修改,可以覆盖biber的sourcemap功能。 功能大体是完整了的。说实话,因为只是替代性的功能,没有什么太多的创新可以说的,我也就只是放在github上面,也没有什么宣传,所以到现在也只是几颗星而已。而且我自己也不怎么用,我自己用biblatex也没怎么用到过文献的排序功能。但其实使用biblatex的同学和老师,其实已经遇到过一些在使用biblatex时排序遇到多音字的问题并向我提问过,但我也只是提供了手动添加的方案,没有深入介绍。今天耿老师也遇到这个问题,问有没有自动化工具,我回答是我之前写的bibmap是可以实现这个功能的,所以我又翻看了一下bibmap的实现,没想到的是其实我之前就已经实现了的,只是没有那么专门的选项什么的,所以我今天又完善了一下它,使得使用起来更为的方便。刚刚耿老师测试了一下,回复说好用,我想我还是要分享一下这个有用的工具。

使用方法

具体使用方法为:

  1. https://github.com/hushidong/biblatex-map 下载bibmap程序。下载整个binary目录即可。

  2. 把需要添加拼音的bib文件放到这个binary目录下面,然后在命令行,运行命令:

bibmap.exe  biblatex-map-test.bib --nofmt --addpinyin
或
bibmap.exe biblatex-map-test.bib --nofmt -m bibmapaddpinyinkey.py
或
python bibmap.py biblatex-map-test.bib --nofmt --addpinyin
或
python bibmap.py biblatex-map-test.bib --nofmt -m bibmapaddpinyinkey.py
  1. 得到新的bib文件为newbiblatex-map-test.bib。

其命名规则是:如果原文件c.bib,则修改后的文件名为newc.bib。

使用测试

一个c.BIB文件内容如下:

@book{bjszxmzhzjwyh,
  author       = {北京市政协民族和宗教委员会 and
                 北京联合大学民族与宗教研究所},
  title        = {历代王朝与民族宗教},
  address      = {北京},
  publisher    = {民族出版社},
  year         = {2012},
  pages        = {112},
}


@article{walls,
  author       = {Walls, Susan C. and Barichivich, William J. and Brown, Mary
                 E.},
  title        = {Drought, Deluge and Declines: the Impact of Precipitation
                 Extremes on Amphibians in a Changing Climate},
  journal      = {Biology},
  year         = {2013},
  volume       = {2},
  number       = {1},
  pages        = {399--418},
  urldate      = {2013-11-04},
  url          = {http://www.mdpi.com/2079-7737/2/1/399},
  doi          = {10.3390/biology2010399},
}

@standard{qgxxywxbzhjswyh,
  author       = {全国信息与文献标准化技术委员会},
  series       = {信息与文献},
  title        = {都柏林核心元数据元素集},
  number       = {GB/T 25100—2010},
  address      = {北京},
  publisher    = {中国标准出版社},
  year         = {2010},
  pages        = {2--3},
}



@periodical{zgtsgxh,
  author       = {中国图书馆学会},
  title        = {图书馆学通讯},
  year         = {1957/1990},
  number       = {1-4},
  address      = {北京},
  publisher    = {北京图书馆},
}

@archive{bjsrmzfbgt,
  author       = {北京市人民政府办公厅},
  title        = {关于转发北京市企业投资项目核准暂行实施办法的通知:
                  京政办发[2005]37号},
  year         = {2005},
  date         = {2005-07-12},
  urldate      = {2011-07-12},
  url          = {http://china.findlaw.cn/fagui/p_1/39934.html},
}


@book{wfz,
  author       = {王夫之},
  title        = {宋论},
  edition      = {刻本},
  address      = {金陵},
  publisher    = {湘乡曾国荃},
  year         = {1865(清同治四年)},
}





@book{sommers,
  author       = {Fan, Xuetong and Sommers, Christopher H.},
  title        = {Food Irradiation Research and Technology},
  edition      = {2},
  address      = {Ames, Iowa},
  publisher    = {Blackwell Publishing},
  year         = {2013},
  pages        = {25--26},
  urldate      = {2014-06-26},
  url          = {http://onlinelibrary.wiley.com/doi/10.1002/9781118422557.ch2/summary},
}

@incollection{wfz2,
  title        = {周易外传:卷 5},
  editor       = {王夫之},
  booktitle    = {船山全书},
  number       = {6},
  address      = {长沙},
  publisher    = {岳麓书社},
  year         = {2011},
  pages        = {1109},
}

@incollection{mks,
  author       = {马克思},
  title        = {政治经济学批判},
  editor       = {马克思 and 恩格斯},
  booktitle    = {马克思恩格斯全集},
  volume       = {35},
  address      = {北京},
  publisher    = {人民出版社},
  year         = {2013},
  pages        = {302},
}

@inproceedings{jdq,
  author       = {贾东琴 and 柯平},
  title        = {面向数字素养的高校图书馆数字服务体系研究},
  editor       = {中国图书馆学会},
  booktitle    = {中国图书馆学会年会论文集},
  volume       = {2011 年卷},
  address      = {北京},
  publisher    = {国家图书馆出版社},
  year         = {2011},
  pages        = {45--52},
}


@patent{dyg,
  author       = {邓一刚},
  title        = {全智能节电器},
  number       = {200610171314.3},
  year         = {2006},
  date         = {2006-12-13},
}

@techreport{zghlwlxxzx,
  author       = {中国互联网络信息中心},
  title        = {第 29 次中国互联网络发展现状统计报告},
  year         = {2012},
  date         = {2012-01-16},
  urldate      = {2013-03-26},
  url          = {http://www.cnnic.net.cn/hlwfzyj/hlwxzbg/201201/P020120709345264469680},
}

@phdthesis{deverell,
  author       = {Deverell, William and Igler, David},
  title        = {A Companion to {California} History},
  address      = {New York},
  school       = {John Wiley \& Sons},
  year         = {2013},
  pages        = {21--22},
  date         = {2013-11-15},
  urldate      = {2014-06-24},
  url          = {http://onlinelibrary.wiley.com/doi/10.1002/9781444305036.ch2/summary},
  doi          = {10.1002/9781444305036.ch2},
}

@proceedings{czy,
  editor       = {陈志勇},
  series       = {中国财税文化价值研究},
  title        = {“中国财税文化国际学术研讨会”论文集},
  address      = {北京},
  publisher    = {经济科学出版社},
  year         = {2011},
  urldate      = {2013-10-14},
  url          = {http://apabi.lib.pku.edu.cn/usp/pku/pub.mvc?pid=book.detail&metaid=m.201106228-BPO-889-0135&cult=CN},
}




@techreport{calkin,
  author       = {Calkin, D and Ager, A and Thompson, M},
  title        = {A Comparative Risk Assessment Framework for Wildland Fire
                 Management: the 2010 Cohesive Strategy Science Report},
  number       = {RMRS-GTR-262},
  year         = {2011},
  pages        = {8--9},
}

@incollection{buseck,
  author       = {Buseck, P R and Nord, Jr, G L and Veblen, D R},
  title        = {Subsolidus Phenomena in Pyroxenes},
  booktitle    = {Pyroxense},
  address      = {Washington, D.C.},
  publisher    = {Mineralogical Society of America},
  year         = {c1980},
  pages        = {117--211},
}

运行命令后生成的newc.bib文件为:

%% 
%% bib file modified by biblatex-map.py
%% 2021-05-24T19:55:38
%% 


@book{bjszxmzhzjwyh,
    author = {北京市政协民族和宗教委员会 and 北京联合大学民族与宗教研究所},
    title = {历代王朝与民族宗教},
    address = {北京},
    publisher = {民族出版社},
    year = {2012},
    pages = {112},
    key = {bei3jing1fu2zheng4xie2min2zu2he2zong1jiao1wei1yuan2hui4 and bei3jing1lian2ge3da4xue2min2zu2yu2zong1jiao1yan2jiu1suo3},
}

@article{walls,
    author = {Walls, Susan C. and Barichivich, William J. and Brown, Mary E.},
    title = {Drought, Deluge and Declines: the Impact of Precipitation Extremes on Amphibians in a Changing Climate},
    journal = {Biology},
    year = {2013},
    volume = {2},
    number = {1},
    pages = {399--418},
    urldate = {2013-11-04},
    url = {http://www.mdpi.com/2079-7737/2/1/399},
    doi = {10.3390/biology2010399},
    key = {Walls, Susan C. and Barichivich, William J. and Brown, Mary E.},
}

@standard{qgxxywxbzhjswyh,
    author = {全国信息与文献标准化技术委员会},
    series = {信息与文献},
    title = {都柏林核心元数据元素集},
    number = {GB/T 25100—2010},
    address = {北京},
    publisher = {中国标准出版社},
    year = {2010},
    pages = {2--3},
    key = {quan2guo2xin4xi1yu2wen2xian4biao1zhun3hua1ji4shu4wei1yuan2hui4},
}

@periodical{zgtsgxh,
    author = {中国图书馆学会},
    title = {图书馆学通讯},
    year = {1957/1990},
    number = {1-4},
    address = {北京},
    publisher = {北京图书馆},
    key = {zhong1guo2tu2shu1guan3xue2hui4},
}

@archive{bjsrmzfbgt,
    author = {北京市人民政府办公厅},
    title = {关于转发北京市企业投资项目核准暂行实施办法的通知: 京政办发[2005]37号},
    year = {2005},
    date = {2005-07-12},
    urldate = {2011-07-12},
    url = {http://china.findlaw.cn/fagui/p_1/39934.html},
    key = {bei3jing1fu2ren2min2zheng4fu3ban4gong1ting1},
}

@book{wfz,
    author = {王夫之},
    title = {宋论},
    edition = {刻本},
    address = {金陵},
    publisher = {湘乡曾国荃},
    year = {1865(清同治四年)},
    key = {wang2fu1zhi1},
}

@book{sommers,
    author = {Fan, Xuetong and Sommers, Christopher H.},
    title = {Food Irradiation Research and Technology},
    edition = {2},
    address = {Ames, Iowa},
    publisher = {Blackwell Publishing},
    year = {2013},
    pages = {25--26},
    urldate = {2014-06-26},
    url = {http://onlinelibrary.wiley.com/doi/10.1002/9781118422557.ch2/summary},
    key = {Fan, Xuetong and Sommers, Christopher H.},
}

@incollection{wfz2,
    title = {周易外传:卷 5},
    editor = {王夫之},
    booktitle = {船山全书},
    number = {6},
    address = {长沙},
    publisher = {岳麓书社},
    year = {2011},
    pages = {1109},
    key = {None},
}

@incollection{mks,
    author = {马克思},
    title = {政治经济学批判},
    editor = {马克思 and 恩格斯},
    booktitle = {马克思恩格斯全集},
    volume = {35},
    address = {北京},
    publisher = {人民出版社},
    year = {2013},
    pages = {302},
    key = {ma3ke4sai1},
}

@inproceedings{jdq,
    author = {贾东琴 and 柯平},
    title = {面向数字素养的高校图书馆数字服务体系研究},
    editor = {中国图书馆学会},
    booktitle = {中国图书馆学会年会论文集},
    volume = {2011 年卷},
    address = {北京},
    publisher = {国家图书馆出版社},
    year = {2011},
    pages = {45--52},
    key = {gu3dong1qin2 and ke1ping2},
}

@patent{dyg,
    author = {邓一刚},
    title = {全智能节电器},
    number = {200610171314.3},
    year = {2006},
    date = {2006-12-13},
    key = {deng4yi1gang1},
}

@techreport{zghlwlxxzx,
    author = {中国互联网络信息中心},
    title = {第 29 次中国互联网络发展现状统计报告},
    year = {2012},
    date = {2012-01-16},
    urldate = {2013-03-26},
    url = {http://www.cnnic.net.cn/hlwfzyj/hlwxzbg/201201/P020120709345264469680},
    key = {zhong1guo2hu4lian2wang3lao4xin4xi1zhong1xin1},
}

@phdthesis{deverell,
    author = {Deverell, William and Igler, David},
    title = {A Companion to {California} History},
    address = {New York},
    school = {John Wiley \& Sons},
    year = {2013},
    pages = {21--22},
    date = {2013-11-15},
    urldate = {2014-06-24},
    url = {http://onlinelibrary.wiley.com/doi/10.1002/9781444305036.ch2/summary},
    doi = {10.1002/9781444305036.ch2},
    key = {Deverell, William and Igler, David},
}

@proceedings{czy,
    editor = {陈志勇},
    series = {中国财税文化价值研究},
    title = {“中国财税文化国际学术研讨会”论文集},
    address = {北京},
    publisher = {经济科学出版社},
    year = {2011},
    urldate = {2013-10-14},
    url = {http://apabi.lib.pku.edu.cn/usp/pku/pub.mvc?pid=book.detail&metaid=m.201106228-BPO-889-0135&cult=CN},
    key = {None},
}

@techreport{calkin,
    author = {Calkin, D and Ager, A and Thompson, M},
    title = {A Comparative Risk Assessment Framework for Wildland Fire Management: the 2010 Cohesive Strategy Science Report},
    number = {RMRS-GTR-262},
    year = {2011},
    pages = {8--9},
    key = {Calkin, D and Ager, A and Thompson, M},
}

@incollection{buseck,
    author = {Buseck, P R and Nord, Jr, G L and Veblen, D R},
    title = {Subsolidus Phenomena in Pyroxenes},
    booktitle = {Pyroxense},
    address = {Washington, D.C.},
    publisher = {Mineralogical Society of America},
    year = {c1980},
    pages = {117--211},
    key = {Buseck, P R and Nord, Jr, G L and Veblen, D R},
}

显然中文文献已经自动添加了包含拼音信息的域。

多音字出错的处理

有时默认的拼音可能存在问题,那么这时可以手动调整,方法为:

在 bibmapaddpinyinkey.py 添加需要修改的多音字的拼音,比如:

#设置多音字的首读音
multiplepinyin={
'曾':'zeng1',
'沈':'shen3',
'翟':'zhai2'
}

结论

我写 bibmap 最初应该是有什么冲动的,两个大功能总体也是实现了的,但我想可能还是这个添加拼音的功能可能会是最有用的,所以这里推广一下,方便大家使用。

另外,由于当初写的有些仓促,功能是实现了的,但优化程度可能不高,大家也可以帮忙看一下程序的python源码,有什么问题可以提建议,甚至帮我改改。

暂无评论

  •  8103
  •  21
  •  4
  • 作  者: huzhen 关注 已关注
  • 测试平台:texlive
  • 编译方式:xelatex
  • 源码属性:原创