fulltext/process/psv.py
def _recover_accents(txt: str) -> str:
    """
    Try to recover plain text with garbled accents.

    Hack to try to recover plain text with accents removed from various
    outputs from xpdf pdf->txt which garble accented characters into multi-byte
    sequences often including linefeed characeters
    """
    # umlaut, acute, cedilla, Angstrom. LF is not always present.
    txt = re.subn(r'[\xa8|\xb4|\xb8|\xb0]\x0a?', '', txt)[0]

    # dangerous accents that get represented
    # a printable literals followed by LF
    # (e.g. grave is ` with LF following)
    txt = re.subn(r'[\x5e|\x60|\x7e]\x0a', '', txt)[0]

    # these are straightforward single character substitions (o and O slash)
    txt = txt.replace('\xf8', 'o')
    txt = txt.replace('\xd8', 'O')

    # multi character substitutions (beta->ss)
    txt = txt.replace('\xdf', 'ss')
    txt = txt.replace('\xe6', 'ae')
    txt = txt.replace('\xc6', 'AE')
    return txt

    Try to recover plain text with garbled accents.

    Hack to try to recover plain text with accents removed from various
    outputs from xpdf pdf->txt which garble accented characters into multi-byte
    sequences often including linefeed characeters
    
Try to recover plain text with garbled accents.
Hack to try to recover plain text with accents removed from various
outputs from xpdf pdf->txt which garble accented characters into multi-byte
sequences often including linefeed characeters
Try to recover plain text with garbled accents . Hack to try to recover plain text with accents removed from various outputs from xpdf pdf - > txt which garble accented characters into multi - byte sequences often including linefeed characeters
def _recover_accents(txt: str) -> str:
    txt = re.subn(r'[\xa8|\xb4|\xb8|\xb0]\x0a?', '', txt)[0]
    txt = re.subn(r'[\x5e|\x60|\x7e]\x0a', '', txt)[0]
    txt = txt.replace('\xf8', 'o')
    txt = txt.replace('\xd8', 'O')
    txt = txt.replace('\xdf', 'ss')
    txt = txt.replace('\xe6', 'ae')
    txt = txt.replace('\xc6', 'AE')
    return txt
def _recover_accents ( txt : str ) -> str : txt = re . subn ( r'[\xa8|\xb4|\xb8|\xb0]\x0a?' , '' , txt ) [ 0 ] txt = re . subn ( r'[\x5e|\x60|\x7e]\x0a' , '' , txt ) [ 0 ] txt = txt . replace ( '\xf8' , 'o' ) txt = txt . replace ( '\xd8' , 'O' ) txt = txt . replace ( '\xdf' , 'ss' ) txt = txt . replace ( '\xe6' , 'ae' ) txt = txt . replace ( '\xc6' , 'AE' ) return txt
Try to recover plain text with garbled accents.
Try to recover plain text with garbled accents .
"""
    Try to recover plain text with garbled accents.

    Hack to try to recover plain text with accents removed from various
    outputs from xpdf pdf->txt which garble accented characters into multi-byte
    sequences often including linefeed characeters
    """ # umlaut, acute, cedilla, Angstrom. LF is not always present. # dangerous accents that get represented # a printable literals followed by LF # (e.g. grave is ` with LF following) # these are straightforward single character substitions (o and O slash) # multi character substitutions (beta->ss)
txt
str