srs_metadata_cleaning.py
def sifting_metadata_for_edition_info(list_of_row_lists):
    """
    Sifts copyright OCR text in metadata records to look for keywords
    relevant to potential edition information.

    Parameters
    ----------
    list_of_row_lists: list
        A list of the metadata records returned
        from the original CSV.

    Returns
    ----------
    check_copyright_ocr_for_edition_info: list
        A list with values indicating whether the full copyright OCR text
        needs to be checked for edition information manually, and in what
        order of priority if so.
    """

    copyright_ocr_list = []
    check_copyright_ocr_for_edition_info = []

    for row in list_of_row_lists:
        copyright_ocr = row[5]
        clean_copyright_ocr = str(copyright_ocr).lower()
        cleaner_copyright_ocr = clean_copyright_ocr.replace("\n", "")
        cleanest_copyright_ocr = cleaner_copyright_ocr.replace(" ", "")
        copyright_ocr_list.append(cleanest_copyright_ocr)

    for copyright_ocr_item in copyright_ocr_list:
        if "edition" in copyright_ocr_item:
            check_for_edition_info = "YES -- CHECK FIRST"
            check_copyright_ocr_for_edition_info.append(check_for_edition_info)
        elif " ed." in copyright_ocr_item:
            check_for_edition_info = "YES -- CHECK SECOND"
            check_copyright_ocr_for_edition_info.append(check_for_edition_info)
        else:
            check_for_edition_info = "N"
            check_copyright_ocr_for_edition_info.append(check_for_edition_info)

    return check_copyright_ocr_for_edition_info

    Sifts copyright OCR text in metadata records to look for keywords
    relevant to potential edition information.

    Parameters
    ----------
    list_of_row_lists: list
        A list of the metadata records returned
        from the original CSV.

    Returns
    ----------
    check_copyright_ocr_for_edition_info: list
        A list with values indicating whether the full copyright OCR text
        needs to be checked for edition information manually, and in what
        order of priority if so.
    
Sifts copyright OCR text in metadata records to look for keywords
relevant to potential edition information.
Sifts copyright OCR text in metadata records to look for keywords relevant to potential edition information .
def sifting_metadata_for_edition_info(list_of_row_lists):
    copyright_ocr_list = []
    check_copyright_ocr_for_edition_info = []
    for row in list_of_row_lists:
        copyright_ocr = row[5]
        clean_copyright_ocr = str(copyright_ocr).lower()
        cleaner_copyright_ocr = clean_copyright_ocr.replace("\n", "")
        cleanest_copyright_ocr = cleaner_copyright_ocr.replace(" ", "")
        copyright_ocr_list.append(cleanest_copyright_ocr)
    for copyright_ocr_item in copyright_ocr_list:
        if "edition" in copyright_ocr_item:
            check_for_edition_info = "YES -- CHECK FIRST"
            check_copyright_ocr_for_edition_info.append(check_for_edition_info)
        elif " ed." in copyright_ocr_item:
            check_for_edition_info = "YES -- CHECK SECOND"
            check_copyright_ocr_for_edition_info.append(check_for_edition_info)
        else:
            check_for_edition_info = "N"
            check_copyright_ocr_for_edition_info.append(check_for_edition_info)
    return check_copyright_ocr_for_edition_info
def sifting_metadata_for_edition_info ( list_of_row_lists ) : copyright_ocr_list = [ ] check_copyright_ocr_for_edition_info = [ ] for row in list_of_row_lists : copyright_ocr = row [ 5 ] clean_copyright_ocr = str ( copyright_ocr ) . lower ( ) cleaner_copyright_ocr = clean_copyright_ocr . replace ( "\n" , "" ) cleanest_copyright_ocr = cleaner_copyright_ocr . replace ( " " , "" ) copyright_ocr_list . append ( cleanest_copyright_ocr ) for copyright_ocr_item in copyright_ocr_list : if "edition" in copyright_ocr_item : check_for_edition_info = "YES -- CHECK FIRST" check_copyright_ocr_for_edition_info . append ( check_for_edition_info ) elif " ed." in copyright_ocr_item : check_for_edition_info = "YES -- CHECK SECOND" check_copyright_ocr_for_edition_info . append ( check_for_edition_info ) else : check_for_edition_info = "N" check_copyright_ocr_for_edition_info . append ( check_for_edition_info ) return check_copyright_ocr_for_edition_info
Sifts copyright OCR text in metadata records to look for keywords
relevant to potential edition information.
Sifts copyright OCR text in metadata records to look for keywords relevant to potential edition information .
"""
    Sifts copyright OCR text in metadata records to look for keywords
    relevant to potential edition information.

    Parameters
    ----------
    list_of_row_lists: list
        A list of the metadata records returned
        from the original CSV.

    Returns
    ----------
    check_copyright_ocr_for_edition_info: list
        A list with values indicating whether the full copyright OCR text
        needs to be checked for edition information manually, and in what
        order of priority if so.
    """
list_of_row_lists
A list of the metadata records returned
from the original CSV.
A list of the metadata records returned from the original CSV .
Returns

None
----------

None
check_copyright_ocr_for_edition_info
A list with values indicating whether the full copyright OCR text
needs to be checked for edition information manually, and in what
order of priority if so.
A list with values indicating whether the full copyright OCR text needs to be checked for edition information manually and in what order of priority if so .