Esempio n. 1
0
def get_entities(endpoint, text, conf=0.5, support=5):
    payload = {"text": remove_illegal_chars(text), "confidence": conf, "support": support}
    spotlight_headers = {'accept': 'application/json',
                         'content-type': 'application/x-www-form-urlencoded'}

    response = post_request(endpoint, payload, spotlight_headers)
    return check_json_response(response)
Esempio n. 2
0
def get_entities(endpoint, text, conf=0.5, support=5):
    payload = {
        "text": remove_illegal_chars(text),
        "confidence": conf,
        "support": support
    }
    spotlight_headers = {
        'accept': 'application/json',
        'content-type': 'application/x-www-form-urlencoded'
    }

    response = post_request(endpoint, payload, spotlight_headers)
    return check_json_response(response)
Esempio n. 3
0
def get_entities(text, conf=0.45):
    """
    A function to get annotations.
    :param text: str: text to annotate
    :param conf: float: confidence
    :return: list
    """

    payload = {"text": remove_illegal_chars(text), "confidence": conf}
    spotlight_headers = {'accept': 'application/json',
                         'content-type': 'application/x-www-form-urlencoded'}

    response = post_request(ENDPOINTS["spotlight"], payload, spotlight_headers)
    return check_json_response(response)