Exemplo n.º 1
0
    'Runs an English-speaking chatbot that answers questions about your website'
)
parser.add_argument('conf_file',
                    metavar='JSON_FILE',
                    type=str,
                    help='Read parameters for the program')

# Under which mode will the app run. There is no default mode, you need to choose one
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--train',
                   dest='train',
                   action='store_true',
                   help='Precalculates everything')
group.add_argument('--run',
                   metavar='SENTENCE',
                   type=str,
                   help="Answers to the given input")
args = parser.parse_args()

# Time to read the program parameters
with open(args.conf_file) as f:
    params = json.load(f)

if args.train:
    print(params['bibtex'])
else:
    parsed_input = gluply.read_input(args.run)
    print(parsed_input)
    chatbot = Oracle(params['bibtex'])
    print(chatbot.ask(parsed_input))
Exemplo n.º 2
0
def hello():
    param = request.args.get('request')
    parsed_input = gluply.read_input(param)
    chatbot = Oracle()
    return chatbot.ask(parsed_input)