Machine Learning, NLP, Artificial Intelligence, Machine Intelligence, Tutorial.
performance differences with and without caching. alpha_cache = {} def alpha(pos,state,textList,cachedRecursion = True): if cachedRecursion == True: # if cache is enabled, try to read from cache if alpha_cache.get((pos,state)) != None: return alpha_cache[(pos,state)] if pos == 0: return