colrev.env.tei_parser.TEIParser

class colrev.env.tei_parser.TEIParser(*, pdf_path=None, tei_path=None, consolidate_header=False, consolidate_citations=False)[source]

Bases: object

ColRev-facing TEI API backed by grobid_tei.

Create TEI from a PDF or read an existing TEI file.

If both paths are supplied and tei_path already exists, it is read without contacting GROBID, as in the previous ColRev implementation. Consolidation flags apply when a PDF is submitted to GROBID.

Methods

get_abstract

Get the abstract, using the legacy empty-string value when absent.

get_author_details

Return author details in grobid-tei's native dictionary format.

get_citations_per_section

Get section names mapped to their cited TEI IDs.

get_grobid_version

Get the GROBID version recorded in the TEI, or an empty string.

get_metadata

Return GROBID metadata using CoLRev's record field names.

get_paper_keywords

Get document keywords.

get_references

Return references as ColRev record dictionaries.

get_tei_str

Return the TEI document as a Unicode string.

iter_paragraphs

Iterate over document paragraphs using grobid_tei's extraction.

mark_references

Match references using ColRev and annotate the corresponding TEI IDs.

get_abstract()[source]

Get the abstract, using the legacy empty-string value when absent.

Return type:

str

get_author_details()[source]

Return author details in grobid-tei’s native dictionary format.

Return type:

list

get_citations_per_section()[source]

Get section names mapped to their cited TEI IDs.

Return type:

dict

get_grobid_version()[source]

Get the GROBID version recorded in the TEI, or an empty string.

Return type:

str

get_metadata()[source]

Return GROBID metadata using CoLRev’s record field names.

Bibliographic values come from grobid_tei’s public metadata API.

Return type:

dict

get_paper_keywords()[source]

Get document keywords.

Return type:

list

get_references(*, add_intext_citation_count=False)[source]

Return references as ColRev record dictionaries.

Return type:

list

get_tei_str()[source]

Return the TEI document as a Unicode string.

Return type:

str

iter_paragraphs(*, min_chars=40, exclude_sections=('references', 'reference', 'bibliography', 'acknowledgment', 'acknowledgement', 'appendix'))[source]

Iterate over document paragraphs using grobid_tei’s extraction.

Return type:

Iterator[str]

mark_references(*, records)[source]

Match references using ColRev and annotate the corresponding TEI IDs.

Return type:

None