def METHOD_NAME():
    HOURS_TIME_FRAME = float(demisto.args()["timeFrameHours"])
    THRESHOLD = float(demisto.args()["threshold"])
    TEXT_FIELDS = set(map(lambda x: x.lower(), demisto.args()["textFields"].split(",")))
    IGNORE_CLOSED = demisto.args()["ignoreClosedIncidents"] == "yes"
    INCIDENT_QUERY_SIZE = int(demisto.args()["maximumNumberOfIncidents"])
    MIN_TEXT_LENGTH = int(demisto.args()["minTextLength"])
    MAX_CANDIDATES_IN_LIST = int(demisto.args()["maxResults"])
    TIME_FIELD = demisto.args()["timeField"]
    PRE_PROCESS_TEXT = demisto.args()["preProcessText"] == "true"
    incident = demisto.incidents()[0]
    incident_text = get_texts_from_incident(incident, TEXT_FIELDS)
    if len(incident_text) < MIN_TEXT_LENGTH:
        demisto.results(
            "The text is too short to compare - minimum of %d chars required"
            % MIN_TEXT_LENGTH
        )
        sys.exit(0)
    # get initial candidates list
    candidates = get_incidents_by_time(
        incident[TIME_FIELD],
        incident["type"],
        incident["id"],
        HOURS_TIME_FRAME,
        IGNORE_CLOSED,
        INCIDENT_QUERY_SIZE,
        TIME_FIELD,
    )
    # filter candidates with minimum length constraint
    map(lambda x: add_text_to_incident(x, TEXT_FIELDS), candidates)
    candidates = [
        x for x in candidates if len(x.get(INCIDENT_TEXT_FIELD, 0)) >= MIN_TEXT_LENGTH
    ]
    # compare candidates to the orginial incident using TF-IDF
    candidates_text = map(lambda x: x[INCIDENT_TEXT_FIELD], candidates)
    if PRE_PROCESS_TEXT:
        incident_text = pre_process_nlp(incident_text)
        candidates_text = pre_process_nlp(candidates_text)
    similarity_vector = get_similar_texts(incident_text, candidates_text)
    similar_incidents = []
    for (i, similarity) in enumerate(similarity_vector):
        candidates[i]["similarity"] = similarity
        if similarity >= THRESHOLD:
            similar_incidents.append(candidates[i])
    # update context
    if len(similar_incidents or []) > 0:
        similar_incidents_rows = map(
            lambda incident: incident_to_record(incident, TIME_FIELD), similar_incidents
        )
        similar_incidents_rows = sorted(similar_incidents_rows, key=lambda x: x["Time"])
        context = {
            "similarIncidentList": similar_incidents_rows[:MAX_CANDIDATES_IN_LIST],
            "similarIncident": similar_incidents_rows[0],
            "isSimilarIncidentFound": True,
        }
        markdown_result = tableToMarkdown(
            "Similar incidents",
            similar_incidents_rows,
            headers=["id", "name", "closedTime", "Time", "similarity"],
        )
        return {
            "ContentsFormat": formats["markdown"],
            "Type": entryTypes["note"],
            "Contents": markdown_result,
            "EntryContext": context,
        }
    else:
        context = {"isSimilarIncidentFound": False}
        return {
            "ContentsFormat": formats["markdown"],
            "Type": entryTypes["note"],
            "Contents": "No similar incidents has been found",
            "EntryContext": context,
        }