Skip to content

Commit

Permalink
# 158 Stringify descendants in medline parser
Browse files Browse the repository at this point in the history
  • Loading branch information
nils-herrmann committed Oct 24, 2024
1 parent 30cb4b8 commit 94cffbd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pubmed_parser/medline_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from itertools import chain
from lxml import etree
from collections import defaultdict
from pubmed_parser.utils import read_xml, stringify_children, stringify_descendants, month_or_day_formater
from pubmed_parser.utils import read_xml, stringify_descendants, month_or_day_formater

__all__ = ["parse_medline_xml", "parse_grant_id", "split_mesh"]

Expand Down Expand Up @@ -622,15 +622,15 @@ def parse_article_info(
if section != "UNASSIGNED":
abstract_list.append("\n")
abstract_list.append(abstract.attrib.get(category, ""))
section_text = stringify_children(abstract).strip()
section_text = stringify_descendants(abstract).strip()
abstract_list.append(section_text)
abstract = "\n".join(abstract_list).strip()
else:
abstract = (
stringify_children(article.find("Abstract/AbstractText")).strip() or ""
stringify_descendants(article.find("Abstract/AbstractText")).strip() or ""
)
elif article.find("Abstract") is not None:
abstract = stringify_children(article.find("Abstract")).strip() or ""
abstract = stringify_descendants(article.find("Abstract")).strip() or ""
else:
abstract = ""

Expand Down

0 comments on commit 94cffbd

Please sign in to comment.