Пример #1
0
import sys
import getresponse
print(getresponse.getResponse(int(sys.argv[1])))
import random

import getresponse as gr
import produce_response as pr
from parser import parser

print("\n")
print("Talk to the bot!")
line = ""
while line not in ("q", "quit", "x", "exit", "Q", "X"):
    line = raw_input("Chat:")
    result_list = pr.respond(line)
    result = result_list.pop()
    # choose a random one, heavily weighing ones near the beginning
    while random.randrange(4) != 0:
        result = result_list.pop()
    print(gr.getResponse(result))
Пример #3
0
TODO:
 * learn from user as they talk to the bot
"""

import os.path
import sqlite3
import sys

import db
import getresponse
import logparse.logparse as logparse
import sentence_into_db as sid

EXCEPTION_LIMIT = 10

print(getresponse.getResponse("This will be ignored."))

def getNumBetween(msg, first, last):
    # first and last are inclusive
    while True:
        num = raw_input(msg)
        print('')
        try:
            num = int(num)
        except ValueError:
            print("Not a valid integer")
            print("Try again\n")
            continue
        if not first <= num <= last:
            print("Number too small [{}, {}]".format(first, last))
            print("Try again\n")