import json


def parse_sw(sw_file):
    """ Parse stopword config. """
    with open(sw_file, "r", encoding="utf-8") as sw_stream:
        sw = json.load(sw_stream)

    assert isinstance(sw["wordlist"], list)
    for word in sw["wordlist"]:
        assert isinstance(word, str)

    stopword = sw["wordlist"]
    return stopword