예제 #1
0
def get_component_output_data_line(src_key, src_value):
    have_data_label = False
    data_line = [src_key]
    if isinstance(src_value, Instance):
        if src_value.label is not None:
            data_line.append(src_value.label)
            have_data_label = True
        data_line.extend(data_utils.dataset_to_list(src_value.features))
    else:
        data_line.extend(data_utils.dataset_to_list(src_value))
    return data_line, have_data_label
예제 #2
0
def get_component_output_data_line(src_key, src_value):
    have_data_label = False
    data_line = [src_key]
    is_str = False
    if isinstance(src_value, Instance):
        if src_value.label is not None:
            data_line.append(src_value.label)
            have_data_label = True
        data_line.extend(data_utils.dataset_to_list(src_value.features))
    elif isinstance(src_value, str):
        data_line.extend([value for value in src_value.split(',')])
        is_str = True
    else:
        data_line.extend(data_utils.dataset_to_list(src_value))
    return data_line, have_data_label, is_str