from typing import Counter


def _get_id_based_on_linebreaks(context: str, answer_position: int) -> int:
    """Recover the sentence-id assuming the context is always partiotioned based
    on occurrences of linebreaks.

    Args:
        context: text context of the question
        answer_position: index of last character from answer.
    """
    if answer_position == -1:
        return 0

    sent_id = Counter(context[:answer_position])['\n'] + 1

    return sent_id