def METHOD_NAME(
    cls, filenames, workers=1, threshold=-1, nwords=-1, padding_factor=8
):
    d = MaskedLMDictionary()
    for filename in filenames:
        Dictionary.add_file_to_dictionary(
            filename, d, tokenizer.tokenize_line, workers
        )
    d.finalize(threshold=threshold, nwords=nwords, padding_factor=padding_factor)
    return d