import json


def read_cn5_concat_subj_rel_obj_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 mask_rel(rel):
        return "@{0}@".format(rel.replace("/r/", "cn_"))

    items = []
    for l_id, line in enumerate(open(input_file, mode="r")):
        item = json.loads(line.strip())

        text = " ".join([item["surfaceStart"], mask_rel(item["rel"]), item["surfaceEnd"]])
        items.append({"text": text})

    return items