Example #1
0
def _request_processor_masked(interface, inqueue, dequeue):
    while True:
        request_bytes = inqueue.get()
        if request_bytes is None:
            dequeue.put(None)
            break

        request = rpc_pb2.Request()
        request.ParseFromString(request_bytes[0])
        original_response = interface.process_document(request)

        request = rpc_pb2.Request()
        request.ParseFromString(request_bytes[1])
        response = interface.process_document(request)

        dequeue.put((original_response.SerializeToString(),
                     response.SerializeToString()))
Example #2
0
def split_using_stanford(doc):
    request = rpc_pb2.Request()
    request.request_type = rpc_pb2.Request.SPLIT
    request.document.extend([doc])
    return process_one_document(request)
Example #3
0
def parse_using_stanford(doc):
    request = rpc_pb2.Request()
    request.request_type = rpc_pb2.Request.PARSE_STANFORD
    request.document.extend([doc])
    return process_one_document(request)
Example #4
0
def parse_using_bllip(doc):
    request = rpc_pb2.Request()
    request.request_type = rpc_pb2.Request.PARSE_BLLIP
    request.document.extend([doc])
    return process_one_document(request)