1function vocabList = getVocabList() 2%GETVOCABLIST reads the fixed vocabulary list in vocab.txt and returns a 3%cell array of the words 4% vocabList = GETVOCABLIST() reads the fixed vocabulary list in vocab.txt 5% and returns a cell array of the words in vocabList. 6 7 8%% Read the fixed vocabulary list 9fid = fopen('vocab.txt'); 10 11% Store all dictionary words in cell array vocab{} 12n = 1899; % Total number of words in the dictionary 13 14% For ease of implementation, we use a struct to map the strings => integers 15% In practice, you'll want to use some form of hashmap 16vocabList = cell(n, 1); 17for i = 1:n 18 % Word Index (can ignore since it will be = i) 19 fscanf(fid, '%d', 1); 20 % Actual Word 21 vocabList{i} = fscanf(fid, '%s', 1); 22end 23fclose(fid); 24 25end 26 27