def convert_frt_y_clf(list_target): # convert target label list_convert = load_target_label(list_target) list_target = list() for sentence in list_convert: for label in sentence: list_target.append(label) return list_target
name_svc = 'ftr_reg_svc.csv' name_road = 'ftr_reg_match_road.csv' name_busstop = 'ftr_reg_match_busstop.csv' list_svc = convert_label_CRF(convert_list_CRF(load_file(path_, name_svc)), 'svc') list_road = convert_label_CRF(convert_list_CRF(load_file(path_, name_road)), 'road') list_busstop = convert_label_CRF(convert_list_CRF(load_file(path_, name_busstop)), 'busstop') CRF_F1_reg(list_line_, list_svc, list_road, list_busstop) if __name__ == '__main__': # Calculate the F1 of regular expression # SGFORUMS # path = 'D:/Project/Transportation_SMU-NEC_collaboration/Data/sgforums/20152207_singaporebuses_all_posts/labeling_CRF' # name_ = 'Label_all_crf.txt' # list_line = convert_list_CRF(load_target_label(load_file(path, name_))) # loading_reg_ftr(list_line, command='sgforums') # TWITTER # path_ = 'D:/Project/Transportation_SMU-NEC_collaboration/Data/twitter/labeling_CRF' # name_ = 'labeling_all.txt' # list_line = convert_list_CRF(load_target_label(filterTxt_CRF(load_file(path_, name_), command='removeLink'))) # loading_reg_ftr(list_line, command='twitter') # FACEBOOK path_ = 'D:/Project/Transportation_SMU-NEC_collaboration/Data/facebook/BusNews/labeling_CRF' name_ = 'label.txt' list_line = convert_list_CRF(load_target_label(filterTxt_CRF(load_file(path_, name_), command='removePunc'))) loading_reg_ftr(list_line, command='facebook')