import json


def read_cn5_surface_text_from_json(input_file):
    """
    Reads conceptnet json and returns simple json only with text property that contains clean surfaceText.
    :param input_file: conceptnet json file
    :return: list of items with "text" key.
    """

    def clean_surface_text(surface_text):
        return surface_text.replace("[[", "").replace("]]", "")

    items = []
    for l_id, line in enumerate(open(input_file, mode="r")):
        item = json.loads(line.strip())
        text = clean_surface_text(item["surfaceText"])
        items.append({"text": text})

    return items