アットウィキロゴ

python nested dictionary for suffix trie


def test(t):
    t += '$'
    root = {}
    for i in [[xrange]](len(t)):
        cur = root
        for c in t[i:]:
            cur[c] = {}
            cur = cur[c]

curは(nested dictionaryの中の)current positionというイメージで良いのかな?
最終更新:2014年04月16日 06:04