extractor/fulltext/fulltext.py
def fulltext(pdffile: str, timelimit: int=TIMELIMIT):
    """
    Given a pdf file, extract the unicode text and run through very basic
    unicode normalization routines. Determine the best extracted text and
    return as a string.

    Parameters
    ----------
    pdffile : str
        Path to PDF file from which to extract text

    timelimit : int
        Time in seconds to allow the extraction routines to run

    Returns
    -------
    fulltext : str
        The full plain text of the PDF
    """
    if not os.path.isfile(pdffile):
        raise FileNotFoundError(pdffile)

    try:
        output = run_pdf2txt(pdffile, timelimit=timelimit)
    except (TimeoutExpired, CalledProcessError) as e:
        output = run_pdftotext(pdffile, timelimit=None)

    output = fixunicode.fix_unicode(output)
    wordlength = average_word_length(output)

    if wordlength <= 45:
        return output

    output = run_pdf2txt_A(pdffile, timelimit=timelimit)
    output = fixunicode.fix_unicode(output)
    wordlength = average_word_length(output)

    if wordlength > 45:
        raise RuntimeError(
            'No accurate text could be extracted from "{}"'.format(pdffile)
        )

    return output

    Given a pdf file, extract the unicode text and run through very basic
    unicode normalization routines. Determine the best extracted text and
    return as a string.

    Parameters
    ----------
    pdffile : str
        Path to PDF file from which to extract text

    timelimit : int
        Time in seconds to allow the extraction routines to run

    Returns
    -------
    fulltext : str
        The full plain text of the PDF
    
Given a pdf file, extract the unicode text and run through very basic
unicode normalization routines. Determine the best extracted text and
return as a string.

Parameters

pdffile : str
Path to PDF file from which to extract text

timelimit : int
Time in seconds to allow the extraction routines to run

Returns

fulltext : str
The full plain text of the PDF
Given a pdf file extract the unicode text and run through very basic unicode normalization routines . Determine the best extracted text and return as a string . Parameters pdffile : str Path to PDF file from which to extract text timelimit : int Time in seconds to allow the extraction routines to run Returns fulltext : str The full plain text of the PDF
def fulltext(pdffile: str, timelimit: int=TIMELIMIT):
    if not os.path.isfile(pdffile):
        raise FileNotFoundError(pdffile)
    try:
        output = run_pdf2txt(pdffile, timelimit=timelimit)
    except (TimeoutExpired, CalledProcessError) as e:
        output = run_pdftotext(pdffile, timelimit=None)
    output = fixunicode.fix_unicode(output)
    wordlength = average_word_length(output)
    if wordlength <= 45:
        return output
    output = run_pdf2txt_A(pdffile, timelimit=timelimit)
    output = fixunicode.fix_unicode(output)
    wordlength = average_word_length(output)
    if wordlength > 45:
        raise RuntimeError(
            'No accurate text could be extracted from "{}"'.format(pdffile)
        )
    return output
def fulltext ( pdffile : str , timelimit : int = TIMELIMIT ) : if not os . path . isfile ( pdffile ) : raise FileNotFoundError ( pdffile ) try : output = run_pdf2txt ( pdffile , timelimit = timelimit ) except ( TimeoutExpired , CalledProcessError ) as e : output = run_pdftotext ( pdffile , timelimit = None ) output = fixunicode . fix_unicode ( output ) wordlength = average_word_length ( output ) if wordlength <= 45 : return output output = run_pdf2txt_A ( pdffile , timelimit = timelimit ) output = fixunicode . fix_unicode ( output ) wordlength = average_word_length ( output ) if wordlength > 45 : raise RuntimeError ( 'No accurate text could be extracted from "{}"' . format ( pdffile ) ) return output
Given a pdf file, extract the unicode text and run through very basic
unicode normalization routines.
Given a pdf file extract the unicode text and run through very basic unicode normalization routines .
"""
    Given a pdf file, extract the unicode text and run through very basic
    unicode normalization routines. Determine the best extracted text and
    return as a string.

    Parameters
    ----------
    pdffile : str
        Path to PDF file from which to extract text

    timelimit : int
        Time in seconds to allow the extraction routines to run

    Returns
    -------
    fulltext : str
        The full plain text of the PDF
    """
pdffile
str
timelimit
int