<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def thaiword_to_num(word: str) -> int: """ Converts a Thai number spellout word to actual number value :param str word: a Thai number spellout :return: number """

    if not word:
        return None

    tokens = []
    if isinstance(word, str):
        tokens = _TOKENIZER.word_tokenize(word)
    elif isinstance(word, Iterable):
        for w in word:
            tokens.extend(_TOKENIZER.word_tokenize(w))

    res = []
    for tok in tokens:
        if tok in _THAIWORD_NUMS_UNITS:
            res.append(tok)
        else:
            m = _NU_PAT.fullmatch(tok)
            if m:
                res.extend([t for t in m.groups() if t])  # ตัด None ทิ้ง
            else:
                pass  # should not be here

    return _thaiword_to_num(res)