workflow2_docsplitter/sam-app/functions/docsplitter_function/index.py [23:40]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def call_comprehend(text, comprehend, endpoint_arn):
    # send in raw text for a document as well as the Comprehend custom classification model ARN
    # returns JSON response containing the document's predicted class
    print("Inputting text into Comprehend model")
    return comprehend.classify_document(
        Text=text,
        EndpointArn=endpoint_arn
    )


def add_page_to_class(i, _class, pages_by_class):
    # appends a page number (integer) to list of page numbers (value in key-value pair)
    # stores information on how the original multi-page input PDF file is divided by class
    # stores page numbers in order, so the final outputted multi-class PDF pages will be in order
    if _class in pages_by_class:
        pages_by_class[_class].append(i)
    else:
        pages_by_class[_class] = [i]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



workflow3_local/local_docsplitter.py [20:37]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def call_comprehend(text, comprehend, endpoint_arn):
    # send in raw text for a document as well as the Comprehend custom classification model ARN
    # returns JSON response containing the document's predicted class
    print("Inputting text into Comprehend model")
    return comprehend.classify_document(
        Text=text,
        EndpointArn=endpoint_arn
    )


def add_page_to_class(i, _class, pages_by_class):
    # appends a page number (integer) to list of page numbers (value in key-value pair)
    # stores information on how the original multi-page input PDF file is divided by class
    # stores page numbers in order, so the final outputted multi-class PDF pages will be in order
    if _class in pages_by_class:
        pages_by_class[_class].append(i)
    else:
        pages_by_class[_class] = [i]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



