Exemplo n.º 1
0
def main():
    # v, s get from the commandline
    v, s = int(sys.argv[1]), sys.argv[2]
    t = sys.stdin.read()
    model = MarkovModel(t, v)
    r = model.replace_unknown(s)
    for i in range(0, len(r)):
        if i == len(r) - 1:
            stdio.writeln(r[i])
        else:
            stdio.write(r[i])
Exemplo n.º 2
0
def main():
    k = int(sys.argv[1])
    s = sys.argv[2]
    text = sys.stdin.read()
    model = MarkovModel(text, k)
    r = model.replace_unknown(s)
    for i in range(0, len(r)):
        if i == len(r) - 1:
            stdio.writeln(r[i])
        else:
            stdio.write(r[i])
Exemplo n.º 3
0
def main():
    k = int(sys.argv[1])
    s = str(sys.argv[2])
    text = sys.stdin.read()
    model = MarkovModel(text, k)
    stdio.writeln(model.replace_unknown(s))
def main():
    # Create a Markov model named model using text and k.
    model = MarkovModel(text, k)

    # Use model.replace_unknown() to decode the corrupted text s.
    stdio.writeln(model.replace_unknown(s))