extractor/fulltext/fulltext.py
def convert_directory(path):
    """
    Convert all pdfs in a given `path` to full plain text. For each pdf, a file
    of the same name but extension .txt will be created. If that file exists,
    it will be skipped.

    Parameters
    ----------
    path : str
        Directory in which to search for pdfs and convert to text

    Returns
    -------
    output : list of str
        List of converted files
    """
    outlist = []

    globber = os.path.join(path, '*.pdf')
    pdffiles = sorted_files(globber)

    log.info('Searching "{}"...'.format(globber))
    log.info('Found: {}'.format(pdffiles))

    for pdffile in pdffiles:
        txtfile = reextension(pdffile, 'txt')

        if os.path.exists(txtfile):
            continue

        # we don't want this function to stop half way because of one failed
        # file so just charge onto the next one
        try:
            text = fulltext(pdffile)
            with open(txtfile, 'w') as f:
                f.write(text)
        except Exception as e:
            log.error("Conversion failed for '{}'".format(pdffile))
            log.exception(e)
            continue

        outlist.append(pdffile)
    return outlist

    Convert all pdfs in a given `path` to full plain text. For each pdf, a file
    of the same name but extension .txt will be created. If that file exists,
    it will be skipped.

    Parameters
    ----------
    path : str
        Directory in which to search for pdfs and convert to text

    Returns
    -------
    output : list of str
        List of converted files
    
Convert all pdfs in a given `path` to full plain text. For each pdf, a file
of the same name but extension .txt will be created. If that file exists,
it will be skipped.

Parameters

path : str
Directory in which to search for pdfs and convert to text

Returns

output : list of str
List of converted files
Convert all pdfs in a given ` path ` to full plain text . For each pdf a file of the same name but extension . txt will be created . If that file exists it will be skipped . Parameters path : str Directory in which to search for pdfs and convert to text Returns output : list of str List of converted files
def convert_directory(path):
    outlist = []
    globber = os.path.join(path, '*.pdf')
    pdffiles = sorted_files(globber)
    log.info('Searching "{}"...'.format(globber))
    log.info('Found: {}'.format(pdffiles))
    for pdffile in pdffiles:
        txtfile = reextension(pdffile, 'txt')
        if os.path.exists(txtfile):
            continue
        try:
            text = fulltext(pdffile)
            with open(txtfile, 'w') as f:
                f.write(text)
        except Exception as e:
            log.error("Conversion failed for '{}'".format(pdffile))
            log.exception(e)
            continue
        outlist.append(pdffile)
    return outlist
def convert_directory ( path ) : outlist = [ ] globber = os . path . join ( path , '*.pdf' ) pdffiles = sorted_files ( globber ) log . info ( 'Searching "{}"...' . format ( globber ) ) log . info ( 'Found: {}' . format ( pdffiles ) ) for pdffile in pdffiles : txtfile = reextension ( pdffile , 'txt' ) if os . path . exists ( txtfile ) : continue try : text = fulltext ( pdffile ) with open ( txtfile , 'w' ) as f : f . write ( text ) except Exception as e : log . error ( "Conversion failed for '{}'" . format ( pdffile ) ) log . exception ( e ) continue outlist . append ( pdffile ) return outlist
Convert all pdfs in a given `path` to full plain text.
Convert all pdfs in a given ` path ` to full plain text .
"""
    Convert all pdfs in a given `path` to full plain text. For each pdf, a file
    of the same name but extension .txt will be created. If that file exists,
    it will be skipped.

    Parameters
    ----------
    path : str
        Directory in which to search for pdfs and convert to text

    Returns
    -------
    output : list of str
        List of converted files
    """ # we don't want this function to stop half way because of one failed # file so just charge onto the next one
path