from typing import List


def char_pos_to_sentence_pos(start_char: int, end_char: int, words: List[str]):
    """
    Converts positions of char spans in a sentence into word positions.

    NOTE: Returned end position is represented inclusive!

    :param start_char: The first character of the span
    :param end_char: The last character of the span
    :param words: A list of words in a sentence
    :return: The start and end position of the WORD in the sentence
    """

    start = -1
    end = -1

    chars = 0

    for i in range(len(words) + 1):
        if start == -1 and start_char <= chars:
            start = i

        if end == -1 and end_char < chars:
            return start, max(i - 1, start)

        if i == len(words):
            break

        # +1 due to empty spaces between words
        chars += len(words[i]) + 1

    raise Exception("Inconsistency: position not inside sentence!")