doc2json/jats2json/pmc_utils/front_tag_utils.py
def parse_abstract_tag(front_tag, soup) -> List[Dict]:
    """Not every paper has an abstract

    Furthermore, note very abstract is structured into sections.
    Some abstracts (see PMC1914226) look like:
        <abstract>
            <p> ... </p>
            <p> ... </p>
        </abstract>
    """
    # TODO: are there cases where <abstract> text <p> text </> </abstract> ?
    abstract: List[Dict] = []
    if front_tag.find('abstract'):
        abstract_tag = front_tag.find('abstract').extract()

        # replace all xref tags with string placeholders
        replace_xref_with_string_placeholders(soup_tag=abstract_tag, soup=soup)

        # replace all sup/sub tags with string placeholders
        replace_sup_sub_tags_with_string_placeholders(soup_tag=abstract_tag, soup=soup)

        if abstract_tag.find('sec'):
            all_par_blobs = []
            for sec_tag in abstract_tag.find_all('sec', recursive=False):
                par_blobs = recurse_parse_section(sec_tag=sec_tag)
                all_par_blobs.extend(par_blobs)
        else:
            all_par_blobs = parse_all_paragraphs_in_section(sec_tag=abstract_tag)
            for par_blob in all_par_blobs:
                # these 'sections' typically show up as empty string
                par_blob['section'] = 'Abstract'
                abstract.append(par_blob)
    return abstract
Not every paper has an abstract

    Furthermore, note very abstract is structured into sections.
    Some abstracts (see PMC1914226) look like:
        <abstract>
            <p> ... </p>
            <p> ... </p>
        </abstract>
    
Not every paper has an abstract
Furthermore, note very abstract is structured into sections.
Some abstracts  look like:

 ...
Not every paper has an abstract Furthermore note very abstract is structured into sections . Some abstracts look like : ...
def parse_abstract_tag(front_tag, soup) -> List[Dict]:
    abstract: List[Dict] = []
    if front_tag.find('abstract'):
        abstract_tag = front_tag.find('abstract').extract()
        replace_xref_with_string_placeholders(soup_tag=abstract_tag, soup=soup)
        replace_sup_sub_tags_with_string_placeholders(soup_tag=abstract_tag, soup=soup)
        if abstract_tag.find('sec'):
            all_par_blobs = []
            for sec_tag in abstract_tag.find_all('sec', recursive=False):
                par_blobs = recurse_parse_section(sec_tag=sec_tag)
                all_par_blobs.extend(par_blobs)
        else:
            all_par_blobs = parse_all_paragraphs_in_section(sec_tag=abstract_tag)
            for par_blob in all_par_blobs:
                par_blob['section'] = 'Abstract'
                abstract.append(par_blob)
    return abstract
def parse_abstract_tag ( front_tag , soup ) -> List [ Dict ] : abstract : List [ Dict ] = [ ] if front_tag . find ( 'abstract' ) : abstract_tag = front_tag . find ( 'abstract' ) . extract ( ) replace_xref_with_string_placeholders ( soup_tag = abstract_tag , soup = soup ) replace_sup_sub_tags_with_string_placeholders ( soup_tag = abstract_tag , soup = soup ) if abstract_tag . find ( 'sec' ) : all_par_blobs = [ ] for sec_tag in abstract_tag . find_all ( 'sec' , recursive = False ) : par_blobs = recurse_parse_section ( sec_tag = sec_tag ) all_par_blobs . extend ( par_blobs ) else : all_par_blobs = parse_all_paragraphs_in_section ( sec_tag = abstract_tag ) for par_blob in all_par_blobs : par_blob [ 'section' ] = 'Abstract' abstract . append ( par_blob ) return abstract
Not every paper has an abstract
Furthermore, note very abstract is structured into sections.
Not every paper has an abstract Furthermore note very abstract is structured into sections .
"""Not every paper has an abstract

    Furthermore, note very abstract is structured into sections.
    Some abstracts (see PMC1914226) look like:
        <abstract>
            <p> ... </p>
            <p> ... </p>
        </abstract>
    """ # TODO: are there cases where <abstract> text <p> text </> </abstract> ? # replace all xref tags with string placeholders # replace all sup/sub tags with string placeholders # these 'sections' typically show up as empty string
front_tag
soup