def get_firstline_parameter(path):
    """
    Parses the parameters logged in the first line of the file
    """
    if path.endswith(".mst"):
        firstline = open(path).readline()
        parts = firstline.split(",")

        scenario = parts[0].split("=")[1]
        char_set = parts[1].split("=")[1]

        w_p = float(parts[2].split("=")[1])
        w_a = float(parts[3].split("=")[1])
        w_f = float(parts[4].split("=")[1])
        w_e = float(parts[5].split("=")[1])

        corpus_weights = {'formal': float(parts[6].split("=")[1]),
                          'twitter': float(parts[7].split("=")[1]),
                          'code': float(parts[8].split("=")[1])}

        return scenario, char_set, w_p, w_a, w_f, w_e, corpus_weights
    else:
        return -1, -1, -1, -1, -1, -1