def get_features(ltable, rtable, attr_types_ltable, attr_types_rtable, attr_corres, tok, sim_funcs):
    if check_table_order(ltable, rtable, attr_types_ltable, attr_types_rtable, attr_corres) is False:
        raise AssertionError('Table order seems to be different than what is mentioned in other params')
    dict_list = []
    autogen_lkp_tbl = get_autogen_lkp_tbl()
    for attrs in attr_corres['corres']:
        attr1_type = attr_types_ltable[attrs[0]]
        attr2_type = attr_types_rtable[attrs[1]]
        if attr1_type != attr2_type:
            logger.warning('%s type and %s type are different' %attrs)
        if attr1_type is 'str_eq_1w':
            rec_fns = autogen_lkp_tbl['STR_EQ_1W']
        elif attr1_type is 'str_bt_1w_5w':
            rec_fns = autogen_lkp_tbl['STR_BT_1W_5W']
        elif attr1_type is 'str_bt_5w_10w':
            rec_fns = autogen_lkp_tbl['STR_BT_5W_10W']
        elif attr1_type is 'str_gt_10w':
            rec_fns = autogen_lkp_tbl['STR_GT_10W']
        elif attr1_type is 'numeric':
            rec_fns = autogen_lkp_tbl['NUM']
        elif attr1_type is 'boolean':
            rec_fns = autogen_lkp_tbl['BOOL']
        else:
            raise TypeError('Unknown type')
        fn_obj = get_fn_objs(attrs, rec_fns, tok, sim_funcs)
        dict_list.append(fn_obj)
    df = pd.DataFrame(dict_list)
    df = df[['function_name', 'left_attribute', 'right_attribute', 'left_attr_tokenizer', 'right_attr_tokenizer',
             'simfunction', 'function']]

    return df
def label(tbl, col_name):
    from magellan.gui.mtable_gui import edit
    table = tbl.copy()
    table.properties = tbl.properties
    table._set_key(table.get_key())
    if col_name in table.columns:
        logger.warning('Input table already contains table with name %s' %col_name)
    else:
        table[col_name] = 0
    edit(table)
    return table
def init_jvm(jvmpath=None):
    if jpype.isJVMStarted():
        logger.warning("JVM is already running")
        return
    # taken from https://github.com/konlpy/konlpy/blob/master/konlpy/jvm.py
    folder_suffix = [
        "{0}{2}",
        "{0}{1}secondstring-20120620.jar{2}",
        "{0}{1}simfunction.jar{2}",
        "{0}{1}simmetrics_jar_v1_6_2_d07_02_07.jar{2}",
        "{0}{1}*",
    ]
    java_dir = "%s%sinst%sjava" % (get_install_path(), os.sep, os.sep)
    if os.name == "nt":
        args = [java_dir, os.sep, ";"]
    else:
        args = [java_dir, os.sep, ":"]
    classpath = os.sep.join(f.format(*args) for f in folder_suffix)
    jvmpath = jvmpath or jpype.getDefaultJVMPath()
    if jvmpath:
        jpype.startJVM(jvmpath, "-Djava.class.path=%s" % classpath)
        logger.info("JVM started")
    else:
        raise ValueError("Please specify the JVM path")