def dict_by_dict(r, dict, table): total_words = [] for key, value in dict.iteritems(): total_words += utility.get_file_words(value.split('\n')) dict = utility.unique(total_words) utility.write_dict_file(dict, table + '.dict') return dict
def dict_by_file(r, table, parse_method=None): file_path_list, file_name_list = utility.get_file_list(r) total_words = [] for file_path in file_path_list: if file_path.startswith('all'): total_words += open(file_path, 'r').readlines() dict = utility.unique(total_words) utility.write_dict_file(dict, r.split('/')[-1] + '.dict') return dict
def dict_by_text(r, table, parse_method=None): file_path_list, file_name_list = utility.get_file_list(r) total_words = [] for file_path in file_path_list: lines = parse_method(file_path) total_words += utility.get_file_words(lines) dict = utility.unique(total_words) utility.write_dict_file(dict, table + '.dict') return dict
def dict_by_file(r, table, parse_method = None): file_path_list, file_name_list = utility.get_file_list(r) total_words = [] for file_path in file_path_list: if file_path.startswith('all'): total_words += open(file_path, 'r').readlines() dict = utility.unique(total_words) utility.write_dict_file(dict, r.split('/')[-1] + '.dict') return dict
def dict_by_text(r, table, parse_method = None): file_path_list, file_name_list = utility.get_file_list(r) total_words = [] for file_path in file_path_list: lines = parse_method(file_path) total_words += utility.get_file_words(lines) dict = utility.unique(total_words) utility.write_dict_file(dict, table + '.dict') return dict