Exemplo n.º 1
0
def main():
    k = int(sys.argv[1])
    T = int(sys.argv[2])
    text = sys.stdin.read()
    model = MarkovModel(text, k)
    z = model.gen(text[:k], T)
    stdio.writeln(z)
Exemplo n.º 2
0
def main():

    # Create a Markov model named model using text and k.
    model = MarkovModel(text, k)

    # Use model.gen() to generate a random text of length T and
    # starting with the first k characters of text.
    rand = model.gen(text[:k], T)

    # Write the random text to standard output.
    stdio.writeln(rand)
Exemplo n.º 3
0
def main():
    k, t = int(sys.argv[1]), int(sys.argv[2])
    text = sys.stdin.read()
    model = MarkovModel(text, k)
    kgram = text[:k]
    print(model.gen(kgram, t))
Exemplo n.º 4
0
def main():
    k, T = int(sys.argv[1]), int(sys.argv[2])
    txt = sys.stdin.read()
    model = MarkovModel(txt, k)
    stdio.writeln(model.gen(txt[:k], T))