コード例 #1
0
ファイル: prefixTree.py プロジェクト: Fakhraddin/stanford-ctc
def scrub():
    words = load_words()
    chars = load_chars()
    fid = open(CHARMAP_PATH+'wordlist','w')
    specials = set(SPECIALS_LIST)
    for word in words:
        if word in specials:
            continue
        skip = False
        for t in word:
            # ignore words with bad symbols
            if t not in chars.keys():
                print word
                skip = True
                break
        if not skip:
            fid.write(word+'\n')
    fid.close()
コード例 #2
0
def scrub():
    words = load_words()
    chars = load_chars()
    fid = open(CHARMAP_PATH + 'wordlist', 'w')
    specials = set(SPECIALS_LIST)
    for word in words:
        if word in specials:
            continue
        skip = False
        for t in word:
            # ignore words with bad symbols
            if t not in chars.keys():
                print word
                skip = True
                break
        if not skip:
            fid.write(word + '\n')
    fid.close()
コード例 #3
0
ファイル: prefixTree.py プロジェクト: Fakhraddin/stanford-ctc
def loadPrefixTree():
    lm = load_lm()
    chars = load_chars()
    words = load_words()
    return PrefixTree(chars,words,lm)
コード例 #4
0
def loadPrefixTree():
    lm = load_lm()
    chars = load_chars()
    words = load_words()
    return PrefixTree(chars, words, lm)