def st(d=False): """ short for sentence, d = delete signal """ used_index = set(st_dict.keys()) index_pool = set(range(100000)) usable_index = index_pool - used_index next_index = sorted(list(usable_index))[0] sentence = raw_input('please type the sentence below:\n\n') exist_sentence = set([x['sentence'] for x in st_dict.values()]) if sentence not in exist_sentence: st_dict[next_index] = {'forget_score': 0, 'sentence': sentence} save()
def show_st(exam=False): temp = [] for index in sorted(st_dict.keys(), key=lambda x: st_dict[x]['forget_score']): sentence = st_dict[index]['sentence'] if not exam: print 'index: ', index,'\n' print sentence, '\n\n' else: temp.append((index, sentence)) if exam: return temp