GithubHelp home page GithubHelp logo

vopaaz / cnki_2_bibtex Goto Github PK

View Code? Open in Web Editor NEW
152.0 2.0 20.0 110 KB

Converting the NoteExpress (.net) file exported by CNKI (**知网) to BibTeX (.bib) file.

License: MIT License

Python 100.00%
cnki bibtex latex bibliography paper

cnki_2_bibtex's Introduction

CNKI_2_BibTeX

Converting the NoteExpress (.net) file exported by CNKI (**知网) to BibTeX (.bib) file.

将**知网导出的 NoteExpress 文献记录转换成 BibTeX 文献记录。中文 README

Downloads PyPI Actions Status codecov

Getting Started

Prerequisites

  • Python3

Installation

pip install cnki2bib

Using

Make sure it's in your PATH.

cnki2bib [OPTIONS] [INPUTFILE]

Arguments:

  • INPUTFILE:
    • The input .net file to be converted. If left blank, the contents in the clipboard will be used.

Options:

  • -c, --copy / -nc, --no-copy

    • Whether or not to copy the result to clipboard.
    • Default: True
  • -od, --outputDefault / -nod, --no-outputDefault

    • Whether or not to create a default .bib file.
    • It has the same name as the source .net file in its directory.
    • Or if the input source is clipboard, it will be 'out.bib' in current working directory.
    • Default: True
  • -o, --outputfile FILENAME

    • Create a certain output .bib file.
  • -f, --id-format [title|nameyear]

    • Choose the format of the ID of BibTeX entries.
      • The first several words (or their pinyin) in the title
      • The first author (or the pinyin) plus year.
    • Default: title
    • Once you have assigned a format, your choice will be saved in ~/.cnki2bib.cfg. It is unnecessary to type this choice since then.
  • --help

    • Show this message and exit.

Finally...

Start using BibTeX to manage the literature references.

Double-click to use

You can find cnki2bib.exe in your Python/Scripts and set it as the default program to open the .net file.

Then when you double-click a .net file, the corresponding BibTeX Entries will be copied to your clipboard, and a .bib file would be created on the same directory.

Use the console to check for Exception if it does not work as expected, and issue is welcomed.

Export NoteExpress .net File on CNKI

FxL8Cq.png

Copy NoteExpress Entry content to the clipboard.

FxL8Cq.png

You have to enable Flash to see the "Copy to clipboard" button.

Then just run cnki2bib in the terminal. The corresponding BibTeX Entries will be copied to your clipboard, and an 'out.bib' file is created at the current directory. 😄

cnki_2_bibtex's People

Contributors

vopaaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cnki_2_bibtex's Issues

BibTeX entries copied to clipboard seems not to work as expected

Hi, i am just using the cnki2bib in terminal after copying the NoteExpress-style reference to the clipboard. It gave me some output as below:

Read the NoteExpress Entry content from the clipboard.
BibTeX entries copied to clipboard.
File 'out.bib' is created at current directory.

And there was out.bib file in my current directory, in which the content is what i want. But it seems that the BibTex entries copied to clipboard not work, and the bibTex-style reference was not copied to the clipboard.

My os is Ubuntu 19.10, and the python version is 3.7.0. Thanks!

isbn and bibtexkey

Thank you so much for offering this amazing software! It works pretty well and straightfoward. A quick suggestion, though, in the current version (6f6aeb4), the output always includes a isbn/issn line. You know, / often causes issues for some programming or editing languages (e.g., markdown). Is it possible to just using issn instead of isbn/issn in the output?

Another suggestion: the default bibtexkey now is the Pinyin of the title, right? They sometimes could be long, unreadable, and distractive, esp. when adding multiple entries in a paper. Can I ask for some other format for the key, e.g., name-year? (Jabref uses such way to create keys, the output is something like Lee2009, while giving the characteristics of Chinese last names, a full name paper might be more proper, such as Sunwukong1986).

转换结果文献类型不对

转化为bib文件的参考文献标识不对
比如这里从知网导出一篇硕士论文,他的.net文件如下

{Reference Type}: Thesis
{Author}: 宋开军
{Year}: 2007
{Title}: 基于波导的微波毫米波空间功率合成技术研究
{URL}: https://kns.cnki.net/kcms/detail/detail.aspx?dbname=CDFD2007&filename=2007101113.nh&dbcode=CDFD
{Date}: 2007-03-01
{Journal}: 电子科技大学
{Issue}: 04
{Pages}: 129-130
{Keywords}: 空间功率合成技术;同轴波导;径向波导;基片集成波导;毫米波
{DOI}: CNKI:CDMD:1.2007.101113

通过cnki2bib.exe转换成.bib后结果如下

@Misc{jiyubodaode,
	author = {宋开军},
	year = {2007},
	title = {基于波导的微波毫米波空间功率合成技术研究},
	url = {https://kns.cnki.net/kcms/detail/detail.aspx?dbname=CDFD2007\&filename=2007101113.nh\&dbcode=CDFD},
	date = {2007-03-01},
	journal = {电子科技大学},
	issue = {04},
	pages = {129-130},
	keywords = {空间功率合成技术;同轴波导;径向波导;基片集成波导;毫米波},
	doi = {CNKI:CDMD:1.2007.101113},
	typeofwork = {Null},
}

.net 已经表明这是学位论文 {Reference Type}: Thesis,但是转换的结果却是 Misc

Failed to phrase the NoteExpress Entry content

I got error.

Failed to phrase the NoteExpress Entry content.
Error message:
'NoneType' object has no attribute 'group'
Failed to copy to the clipboard.
Error message:
local variable 'bib_file_string' referenced before assignment
Failed to write the default output .bib file.
Error message:
local variable 'bib_file_string' referenced before assignment

notexpress source:

{Reference Type}: Journal Article
{Title}: 软组织肉瘤诊治**专家共识(2015年版)
{Translated Title}: Chinese expert consensus on diagnosis and treatment of soft tissue sarcomas (Version 2015)
{Author}: **抗癌协会肉瘤专业委员会
{Author}: **临床肿瘤学会
{Author Address}: 复旦大学附属肿瘤医院|JG001257
{Journal}: 中华肿瘤杂志
{Translated Journal}: Chinese Journal of Oncology
{ISBN/ISSN}:0253-3766
{Year}: 2016
{Issue}: 4
{Pages}: 310-320
{Keywords}: 肉瘤;软组织肿瘤;诊断;治疗;规范
{Abstract}:软组织肉瘤是一类间叶来源的恶性肿瘤,可发生于全身各个部位,各年龄段均可发病。由于发病率低,种类繁多且生物学行为各异,如何规范诊疗一直是临床工作的难点。外科治疗仍然是软组织肉瘤唯一可获得根治和最重要的治疗手段,但在某些肉瘤类型或某些情形下需要进行化疗和放疗,靶向治疗也显示出了良好的前景。目前,对于如何实施规范的多学科综合治疗,如何配合应用各种治疗手段,尚缺乏普遍认可的共识。**抗癌协会肉瘤专业委员会和**临床肿瘤学会以循证医学证据为基础,同时吸纳了部分已获认可的专家经验和研究心得,深入探讨了软组织肉瘤的多学科综合治疗,形成了**专家共识以期为临床诊疗活动发挥指导性作用。
{URL}:https://rs.yiigle.com/CN112152201604/889113.htm
{Database Provider}: 《中华医学杂志》社有限责任公司
{Language}:chi


Empty output

Thank you again for the great module!

Recently detected this empty output issue---it's more a CNKI's fault, though. Just have a check the attached .net file. I found, for some unknown reason, CNKI occasionally produces such NoteExpress files including multiple empty lines. In such case, your module may recognize them as broken file and produces empty bibtex files. I'm not sure whether it's worth your effort. After all, I fell into such case for only twice besides tens of successful cases. but, just leave an issue here, in case it can be fixed by an easy patch (Maybe just let the module omit the "Author address"? No journal would require that info).
CNKI-636862711945718750.zip

Bibtexkey for multiple authors

Thank you for updating the module responding to #2. I compile the new version and it successfully captured the info, yet produced an invalid bibtexkey as following:

@Article{XieXin,WangXiaoZeng2005,
	author = {谢昕,王小增},
	title = {基于公共行政理念的政府公共关系发展历程探析},
	journal = {湖北社会科学},
	year = {2005},
	authoraddress = {**地质大学政法学院,**地质大学政法学院 湖北武汉430074,湖北武汉430074},
	issue = {09},
	pages = {14-16},
	keywords = {政府公共关系;;公共行政;;发展历程;;理念},
	abstract = {在公共行政的历史长河中,政府公共关系是一个新生的事物,它伴随着公共行政的发展而发展,经历了传统公共行政阶段、正统公共行政阶段、新公共行政阶段和新公共管理阶段。改革开放20多年来,我国政府公关的意识已经初步确立并日益得到强化,将来会得到更快的发展。},
	ISBN = {1003-8477},
	ISSN = {1003-8477},
	notes = {42-1112/C},
	databaseprovider = {CNKI},
}

Any way to omit the comma in XieXin,WangXiaoZeng2005?
Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.