def METHOD_NAME(vocab_file):
    with open(vocab_file, "r", encoding="utf-8") as r:
        if vocab_file.suffix == '.txt':
            return {t.rstrip("\n"): i for i, t in enumerate(r.readlines())}
        elif vocab_file.suffix == '.json':
            return json.load(r)