#!/usr/bin/env python

# Copyright © 2012 marmuta <marmvta@gmail.com>
#
# This file is part of Onboard.
#
# Onboard is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Onboard is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from string import ascii_lowercase
from random import sample
from pypredict import *

def main():
    model = DynamicModel(3)

    for loop in xrange(10):
        print loop
        tokens = []
        for i in xrange(10000):
            tokens.append(u"".join(sample(ascii_lowercase,8)))
        model.learn_tokens(tokens)
        

    counts, totals = model.get_counts()
    for i,c in enumerate(counts):
        sys.stdout.write("%d-grams: types %10d, occurences %10d\n" % \
              (i+1, counts[i], totals[i]))

if __name__ == '__main__':
    main()

