|
You can also do this recursively: -- Generate n-gram fro symbols with specified length function ngram(symbols, length, part) part = part or "" if length == 0 then print(part); return end for ix = 1, #symbols do ngram(symbols, length - 1, part .. symbols:sub(ix,ix)) end end ngram("abc", 3) --Tim On Mar 20, 2013, at 8:49 AM, Chris Datfung <chris.datfung@gmail.com> wrote:
|