The Bibitem parser takes a LaTeX bibitem as input and parses it to a
Publication
object. The parser has the following characteristics:
It parses the given information without any required fields. For instance, it reads the title of book in the following
bibitemwhile it is missing other information such as author name and publisher.@"@book{, title = {Awesome Book}}"The parser reads common LaTeX typeset used in
bibitemsuch as accented letters (e.g.,\"e).Accounts for some common inconsistencies in
bibitem. For instancevolume = {{10}}while it should bevolume = {10}, ordoi={NA}while instead this field should not be given.It comes with generic and concrete constructors, hence can use built-in models or use user-provided types. For instance:
// Concretevarparser=newParser();// Genericvarparser=newParser<Publication,Author,Keyword>(newPublicationConstructor(),newAuthorConstructor(),newKeywordConstructor());// For details, see examples below.
Accessible and modifiable regex pattern, custom attribute delimiter, custom keyword delimiter, and stop-words.
This is the simplest usage of the parser where it parses
bibitem to built-in models.
usingGenometric.BibitemParser;// Sample input.varbibitem=@"@ARTICLE{8468044, author={Jalili, Vahid}, title={Next Generation Indexing for Genomic Intervals}, year={2019}, doi={10.1109/TKDE.2018.2871031}}";// Initialize the parser.varparser=newParser();// Parse the sample bibitem.boolstatus=parser.TryParse(bibitem,outPublicationpub);// Assert the parsed information.Xunit.Assert.True(status);Xunit.Assert.Contains(pub.Authors, a =>a.FirstName=="Vahid"&&a.LastName=="Jalili");Xunit.Assert.Equal(pub.DOI,"10.1109/TKDE.2018.2871031");This example shows how to provide custom types to the parser.
The provided types implement their respective interfaces, which
are defined in
this directory.
See built-in models as example on how to implement custom types
(e.g., the built-in
Publication
type).
usingGenometric.BibitemParser;usingGenometric.BibitemParser.Model;usingGenometric.BibitemParser.Constructors;// Sample input.varbibitem=@"@ARTICLE{8468044, author={Jalili, Vahid}, title={Next Generation Indexing for Genomic Intervals}, year={2019}, doi={10.1109/TKDE.2018.2871031}}";// Initialize the parser.varparser=newParser<Publication,Author,Keyword>(newPublicationConstructor(),newAuthorConstructor(),newKeywordConstructor());// Parse the sample bibitem.boolstatus=parser.TryParse(bibitem,outPublicationpub);// Assert the parsed information.Xunit.Assert.True(status);Xunit.Assert.Contains(pub.Authors, a =>a.FirstName=="Vahid"&&a.LastName=="Jalili");Xunit.Assert.Equal(pub.DOI,"10.1109/TKDE.2018.2871031");