pubmed_parser/medline_parser.py
def parse_author_affiliation(medline):
    """Parse MEDLINE authors and their corresponding affiliations

    Parameters
    ----------
    medline: Element
        The lxml node pointing to a medline document

    Returns
    -------
    authors: list
        List of authors and their corresponding affiliation in dictionary format
    """
    authors = []
    article = medline.find('Article')
    if article is not None:
        author_list = article.find('AuthorList')
        if author_list is not None:
            authors_list = author_list.findall('Author')
            for author in authors_list:
                if author.find('ForeName') is not None:
                    forename = (author.find('ForeName').text or '').strip() or ''
                else:
                    forename = ''
                if author.find('Initials') is not None:
                    firstname = (author.find('Initials').text or '').strip() or ''
                else:
                    firstname = ''
                if author.find('LastName') is not None:
                    lastname = (author.find('LastName').text or '').strip() or ''
                else:
                    lastname = ''
                if author.find('AffiliationInfo/Affiliation') is not None:
                    affiliation = author.find('AffiliationInfo/Affiliation').text or ''
                    affiliation = affiliation.replace("For a full list of the authors' affiliations please see the Acknowledgements section.", '')
                else:
                    affiliation = ''
                authors.append({
                    'forename': forename,
                    'firstname': firstname,
                    'lastname': lastname,
                    'affiliation': affiliation
                })
    return authors
Parse MEDLINE authors and their corresponding affiliations

    Parameters
    ----------
    medline: Element
        The lxml node pointing to a medline document

    Returns
    -------
    authors: list
        List of authors and their corresponding affiliation in dictionary format
    
Parse MEDLINE authors and their corresponding affiliations
Parameters

Element
The lxml node pointing to a medline document

Returns

list
List of authors and their corresponding affiliation in dictionary format
Parse MEDLINE authors and their corresponding affiliations Parameters Element The lxml node pointing to a medline document Returns list List of authors and their corresponding affiliation in dictionary format
def parse_author_affiliation(medline):
    authors = []
    article = medline.find('Article')
    if article is not None:
        author_list = article.find('AuthorList')
        if author_list is not None:
            authors_list = author_list.findall('Author')
            for author in authors_list:
                if author.find('ForeName') is not None:
                    forename = (author.find('ForeName').text or '').strip() or ''
                else:
                    forename = ''
                if author.find('Initials') is not None:
                    firstname = (author.find('Initials').text or '').strip() or ''
                else:
                    firstname = ''
                if author.find('LastName') is not None:
                    lastname = (author.find('LastName').text or '').strip() or ''
                else:
                    lastname = ''
                if author.find('AffiliationInfo/Affiliation') is not None:
                    affiliation = author.find('AffiliationInfo/Affiliation').text or ''
                    affiliation = affiliation.replace("For a full list of the authors' affiliations please see the Acknowledgements section.", '')
                else:
                    affiliation = ''
                authors.append({
                    'forename': forename,
                    'firstname': firstname,
                    'lastname': lastname,
                    'affiliation': affiliation
                })
    return authors
def parse_author_affiliation ( medline ) : authors = [ ] article = medline . find ( 'Article' ) if article is not None : author_list = article . find ( 'AuthorList' ) if author_list is not None : authors_list = author_list . findall ( 'Author' ) for author in authors_list : if author . find ( 'ForeName' ) is not None : forename = ( author . find ( 'ForeName' ) . text or '' ) . strip ( ) or '' else : forename = '' if author . find ( 'Initials' ) is not None : firstname = ( author . find ( 'Initials' ) . text or '' ) . strip ( ) or '' else : firstname = '' if author . find ( 'LastName' ) is not None : lastname = ( author . find ( 'LastName' ) . text or '' ) . strip ( ) or '' else : lastname = '' if author . find ( 'AffiliationInfo/Affiliation' ) is not None : affiliation = author . find ( 'AffiliationInfo/Affiliation' ) . text or '' affiliation = affiliation . replace ( "For a full list of the authors' affiliations please see the Acknowledgements section." , '' ) else : affiliation = '' authors . append ( { 'forename' : forename , 'firstname' : firstname , 'lastname' : lastname , 'affiliation' : affiliation } ) return authors
Parse MEDLINE authors and their corresponding affiliations
Parameters
Parse MEDLINE authors and their corresponding affiliations Parameters
"""Parse MEDLINE authors and their corresponding affiliations

    Parameters
    ----------
    medline: Element
        The lxml node pointing to a medline document

    Returns
    -------
    authors: list
        List of authors and their corresponding affiliation in dictionary format
    """
medline