feature_dictionary[language_code]="Tense-aspect prefixes" if feature_dictionary[language_code]!=wals_value: output.write(language_code+"\n") output.write("Our value "+feature_dictionary[language_code]+" WALS "+wals_value+"\n") for igt in igt_list: printIGT(igt,output) print(language_code,prefix_count,suffix_count,affix_count,no_affix_count,wals_value) print(str(lang_count),"languages classified") #find the accuracy possibilities = ["Tense-aspect prefixes","Tense-aspect suffixes","Mixed type","No tense-aspect inflection","Tense-aspect tone"] confusion_matrix = ConfusionMatrix("Generated and WALS", possibilities) correct=0 for code in feature_dictionary: our_value = feature_dictionary[code] try: wals_code = wals_dictionary.iso_to_wals[code] wals_value = wals.feature_dictionary[wals_code] confusion_matrix.addLabel(wals_value, our_value) except KeyError: print("No matching WALS data for language " + code) print(confusion_matrix.printMatrix()) print("baseline accuracy:"+str(baseline_correct/lang_count)) output.close() results.close()