def option6(gesture_file, vector_model, top_k_input=None): util.load_user_settings() filenames = util.get_files('./wrd_data', '.wrd') distances = [] for filename in filenames: gesture_id = filename.split('.')[0] distance = gesture_edit_distance(gesture_file, gesture_id) distances.append((gesture_id, distance)) distances.sort(key=lambda pair: pair[1]) return distances
import task3_util as util import general_util as gen_util from task2 import options import numpy as np import os from sklearn import decomposition from sklearn.preprocessing import MinMaxScaler # Main if __name__ == '__main__': # Load User Settings gen_util.load_user_settings() # Load arguments p = int(input('How many principle components to return: ')) # List options print('Options:') for option_number, (option_name, _, _) in options.items(): print(f'{option_number}. {option_name}') option = int(input('Please select an option: ')) while option not in options: print('Invalid option. Please try again.') option = int(input('Please select an option: ')) top_k_input = None if option in [2,3,4,5]: top_k_input = int(input('How many top-k components did you specify during Task 1? (e.g. 1, 2, etc.): ')) vector_model = None
option: int): if option not in options: raise ValueError(f'Invalid option') top_k_input = None if option in [2, 3, 4, 5]: top_k_input = int( input( 'How many top-k components did you specify during Task 1? (e.g. 1, 2, etc.): ' )) return options[option][1](gesture_file, vector_model, top_k_input)[0:10] # Main if __name__ == '__main__': # Load User Settings util.load_user_settings() # Load arguments gesture_file = input('Gesture file (e.g. 1, 249, 559, etc.): ') # List options print('Options:') for option_number, (option_name, _, _) in options.items(): print(f'{option_number}. {option_name}') option = int(input('Please select an option: ')) while option not in options: print('Invalid option. Please try again.') option = int(input('Please select an option: ')) vector_model = None