misanthropicbit / bibpy Goto Github PK
View Code? Open in Web Editor NEWPython library for reading, writing and manipulating Bib(la)tex data
Home Page: https://bibpy.readthedocs.io/en/latest/
License: BSD 3-Clause "New" or "Revised" License
Python library for reading, writing and manipulating Bib(la)tex data
Home Page: https://bibpy.readthedocs.io/en/latest/
License: BSD 3-Clause "New" or "Revised" License
Support for Python 2.7 will be dropped 1 January, 2020. The plan is to only support Python 3.4+ thereafter.
Such a codec would translate LaTeX symbol notation to Python unicode and vice versa. Observe:
>>> from bibpy.codec import decode, encode
>>> decode('Kurt G{\"o}del')
'Kurt Gödel'
>>> encode(_)
'Kurt G{\"o}del'
A unicode to LaTeX mapping exists here.
The lexers/parsers throw away information about line number positions. This is problematic for tools like bibformat
which should maintain the same relative positions of comments and entries in files as those given in the input. This is sensible for comments that are given for a specific entry.
However, it is more complicated than that. What if a comment appears two entries that both change position after being processed by bibformat
? We cannot sort by line number as this would undo the reordering. Instead we could store a relative position, e.g. a comment with position 1 should be placed after the first entry has been output. Since we cannot know if a comment belongs to a certain entry, the least we can do is keep its position in the file.
Retrieving the value of a missing field with default value fails.
import bibpy
ref = """
@misc{reddit_2022,
title = {R/reinforcementlearning. Are exploration and credit assignment independent? What's your opinion?},
url = {https://www.reddit.com/r/reinforcementlearning/comments/vobvly/are_exploration_and_credit_assignment_independent/},
ournal = {reddit},
year = {2022},
month = {Jun}
}
"""
references = bibpy.read_string(ref)
for ref in references:
author = ref.get("author", default="")
assert author == "", "author is not an empty string, but {}".format(str(author))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.