def read_doc(doc_path):
    """
    Read a document and return its text as a string. Replace newline, "\n", 
    and returns, "\r", escape character with a space. Modified after Using 
    Python for Research lecture code on Language Processing.
    """
    with open(doc_path, "r", encoding="utf8") as current_file:
        text = current_file.read()
        text = text.replace("\n", " ").replace("\r", " ")
    return text