def char_to_word_index(ci, sequence):
    """
    Given a character-level index (offset),
    return the index of the **word this char is in**
    """
    i = None
    for i, co in enumerate(sequence.char_offsets):
        if ci == co:
            return i
        elif ci < co:
            return i - 1
    return i