def text_to_ids(source_text, target_text, source_vocab_to_int, target_vocab_to_int):
    """
    Convert source and target text to proper word ids
    :param source_text: String that contains all the source text.
    :param target_text: String that contains all the target text.
    :param source_vocab_to_int: Dictionary to go from the source words to an id
    :param target_vocab_to_int: Dictionary to go from the target words to an id
    :return: A tuple of lists (source_id_text, target_id_text)
    """
    source_id_text = []
    target_id_text = []
    for text in source_text.split('\n'):
        source_id_text.append([source_vocab_to_int[w] for w in text.split()])
        
    for text in target_text.split('\n'):
        target_id_text.append([target_vocab_to_int[w] for w in text.split()] + [target_vocab_to_int['<EOS>']])

    return source_id_text, target_id_text