import json


def clean(text):
    # TODO: Remove lines with ???
    # Replace literal newlines
    # Remove empty lines
    # Replace ’ by '
    pass


if __name__ == '__main__':
    corpus: str = ""

    with open("../data/Lyrics_LucioBukowski.json") as f:
        text = json.load(f)
        songs = text["songs"]
        for song in songs:
            lyrics = song["lyrics"]
            if lyrics is not None:
                corpus += lyrics + "\n"

        corpus = "\n".join([l.replace("’", "\'")
                            for l in corpus.split("\n")
                            if l != ""
                            and l.find("RapGenius France") == -1])

        print(corpus)
        with open("../data/genius.txt", "w+") as o:
            o.writelines(corpus)

