Exemplo n.º 1
0
def ____get_features_vars(m_str):
    #print '1111',m_str
    feature_list = list()
    var_list = list()
    names_list = list()
    functions = Util.get_paras_from_str(m_str)
    for function in functions:
        fun_name, fun_para, fun_value = Util.parse_relation_or_function(
            function)
        var_list += [
            mvar for mvar in Util.get_paras_from_str(fun_para) + [fun_value]
            if Util.isVar(mvar)
        ]
        feature_list.append(Util.generate_function_feature(function))
        names_list.append(fun_name)
    return names_list, feature_list, var_list
Exemplo n.º 2
0
def ____get_vars_from_relations(relation_list):
    if relation_list == [""]:
        return list()
    var_list = list()
    for relation in relation_list:
        fun_name, fun_para, fun_value = Util.parse_relation(relation)
        fun_name2, fun_para2, fun_value2 = Util.parse_function(relation)
        if fun_name == None and fun_name2 == None:
            print '~~~~~~(ERROR):', relation
            error_message = "#Error-----when parsing str %s-----Util.parse_relation: Exist" % relation
            raise Exception(error_message)
        if fun_name == None:
            fun_name, fun_para, fun_value = fun_name2, fun_para2, fun_value2
        var_list += [
            mvar for mvar in Util.get_paras_from_str(fun_para) + [fun_value]
            if Util.isVar(mvar)
        ]
    return var_list