def AnalysisComparison(text, record, expectList=[], noneList=[]): funcList = [mmseg_segfun, ICTCLAS_segfun] we = WeightEngine(mmseg_segfun) we.load_record(record) # compareStatus(list_basic) stop_list = [u"的", u"。", u",", u"是"] + STOPLIST result = export_mmseg(we, text, funcList, stop_list, expectList, noneList) compareStatus(result)
def report_all(n=50): result = [["mmseg", "ICTCLAS", "mmseg(with STOPWORDS)", "ICTCLAS(with STOPWORDS)"]] for item in build_dict(mmseg_segfun, n, filename = "mmseg_save.bak"): element = [item[0] + str(item[1]), ] result.append(element) index = 1 for item in build_dict(ICTCLAS_segfun, n, filename = "ICTCLAS_save.bak"): result[index].append(item[0] + str(item[1])) index += 1 stop_list = [u"的", u"。", u",", u"是"] + STOPLIST index = 1 for item in build_dict(mmseg_segfun, n, stopword_list = stop_list, filename = "mmseg_save_with_stopwords.bak"): result[index].append(item[0] + str(item[1])) index += 1 index = 1 for item in build_dict(ICTCLAS_segfun, n, stopword_list = stop_list, filename = "ICTCLAS_save_with_stopwords.bak"): result[index].append(item[0] + str(item[1])) index += 1 compareStatus(result)
def report_using_save(count=50): result = [["mmseg", "ICTCLAS", "mmseg(with STOPWORDS)", "ICTCLAS(with STOPWORDS)"]] for item in load_dict_from_save(filename = "mmseg_save.bak", n = count): element = [item[0] + str(item[1]), ] result.append(element) index = 1 for item in load_dict_from_save(filename = "ICTCLAS_save.bak", n = count): result[index].append(item[0] + str(item[1])) index += 1 index = 1 for item in load_dict_from_save(filename = "mmseg_save_with_stopwords.bak", n = count): result[index].append(item[0] + str(item[1])) index += 1 index = 1 for item in load_dict_from_save(filename = "ICTCLAS_save_with_stopwords.bak", n = count): result[index].append(item[0] + str(item[1])) index += 1 compareStatus(result)
def test_compareStatus(self): l = [["", "mmseg", "ICTCLAS", "online(hehe)"], ["tf-idf", "tete", "dd<", "dd"]] compareStatus(l) pass