**Not officially supported.**
    Get word frequency of a word by domain.
    This function will make a query to the server of Thai National Corpus.
    Internet connection is required.

    **IMPORTANT:** Currently (as of 29 April 2019) always return 0,
    as the service URL has been changed and the code is not updated yet.

    :param string word: word
    :param string domain: domain

def word_freq(word: str, domain: str = "all") -> int:
    """
    **Not officially supported.**
    Get word frequency of a word by domain.
    This function will make a query to the server of Thai National Corpus.
    Internet connection is required.

    **IMPORTANT:** Currently (as of 29 April 2019) always return 0,
    as the service URL has been changed and the code is not updated yet.

    :param string word: word
    :param string domain: domain
    """
    listdomain = {
        "all": "",
        "imaginative": "1",
        "natural-pure-science": "2",
        "applied-science": "3",
        "social-science": "4",
        "world-affairs-history": "5",
        "commerce-finance": "6",
        "arts": "7",
        "belief-thought": "8",
        "leisure": "9",
        "others": "0",
    }
    url = "http://www.arts.chula.ac.th/~ling/TNCII/corp.php"
    # New URL is http://www.arts.chula.ac.th/~ling/tnc3/
    data = {"genre[]": "", "domain[]": listdomain[domain], "sortby": "perc", "p": word}

    r = requests.post(url, data=data)

    pat = re.compile(r'TOTAL</font>(?s).*?#ffffff">(.*?)</font>')
    match = pat.search(r.text)

    n = 0
    if match:
        n = int(match.group(1).strip())

    return n