def conv_seq_to_sent_symbols(seq, excl_symbols=None, end_symbol='.',
                             remove_end_symbol=True):
    """
    Converts sequences of tokens/ids into a list of sentences (tokens/ids).

    :param seq: list of tokens/ids.
    :param excl_symbols: tokens/ids which should be excluded from the final
                         result.
    :param end_symbol: self-explanatory.
    :param remove_end_symbol: whether to remove from each sentence the end
                              symbol.
    :return: list of lists, where each sub-list contains tokens/ids.
    """
    excl_symbols = excl_symbols if excl_symbols else {}
    assert end_symbol not in excl_symbols
    coll = []
    curr_sent = []
    for symbol in seq:
        if symbol in excl_symbols:
            continue
        if symbol == end_symbol:
            if not remove_end_symbol:
                curr_sent.append(symbol)
            coll.append(curr_sent)
            curr_sent = []
        else:
            curr_sent.append(symbol)
    if curr_sent:
        coll.append(curr_sent)
    return coll