function vocabulary = scowlWordList(folderName,language,maxSize)
%scowlWordList Import word list from SCOWL
%   vocabulary = scowlWordList(folderName,language,maxSize) imports the
%   words from the SCOWL word lists with the specified language and maximum
%   size from the files in folderName.

name = fullfile(folderName,"final",language + "-words.*");
files = dir(name);

vocabulary = [];

numFiles = numel(files);
for i = 1:numFiles
    folder = files(i).folder;
    name = files(i).name;
    filename = fullfile(folder,name);
    
    [~,~,ext] = fileparts(name);
    
    if str2double(ext(2:end)) <= maxSize
        str = extractFileText(filename);
        vocabulary = [vocabulary split(str)'];
    end
end

idx = vocabulary == "";
vocabulary(idx) = [];

end

