diff options
Diffstat (limited to 'grobid_tei_xml/types.py')
-rw-r--r-- | grobid_tei_xml/types.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/grobid_tei_xml/types.py b/grobid_tei_xml/types.py index 725871b..32b773b 100644 --- a/grobid_tei_xml/types.py +++ b/grobid_tei_xml/types.py @@ -102,6 +102,27 @@ class GrobidBiblio: istex_id: Optional[str] = None url: Optional[str] = None + def is_empty(self) -> bool: + """ + If true, this record is empty (contains no actual metadata) + """ + if self.authors or self.editors: + return False + return not bool( + self.date + or self.title + or self.journal + or self.publisher + or self.volume + or self.issue + or self.pages + or self.doi + or self.pmid + or self.pmcid + or self.arxiv_id + or self.url + ) + def to_dict(self) -> dict: return _simplify_dict(asdict(self)) |