'Add a word to dictionary.
freq and tag can be omitted, freq defaults to be a calculated value
that ensures the word can be cut out.'

def add_word(self, word, freq=None, tag=None):

    self.check_initialized()
    word = strdecode(word)
    freq = (int(freq) if (freq is not None) else self.suggest_freq(word, False))
    self.FREQ[word] = freq
    self.total += freq
    if tag:
        self.user_word_tag_tab[word] = tag
    for ch in xrange(len(word)):
        wfrag = word[:(ch + 1)]
        if (wfrag not in self.FREQ):
            self.FREQ[wfrag] = 0
