<commit_before>from flask import Flask
from flask import g
from flask import render_template
from flask import abort
from flask import request
from flask import url_for
from flask import redirect
from flask import session

import chatbot_brain
from input_filters import input_funcs
from output_filters import funct_dict

app = Flask(__name__)


@app.route('/')
def show_chatbot(submission="...crickets...", reply="Say something to me!",
                 sausage={'default': "I haven't said anything yet..."}):
    """Displays base.html when user goes to main page."""
    return render_template('base.html', reply=reply, sausage=sausage,
                           input_filters=input_funcs,
                           output_filters=funct_dict)


@app.route('/submit', methods=['GET', 'POST'])
def submit():
    """Accepts user submission, creates reply, redirects to homepage."""
    submission = request.form['submission']
    input_ = request.form['input_filter']
    print input_
    output_ = []
    output_.append(request.form['output_filter'])
    output_.append(request.form['output_filter2'])
    output_.append(request.form['output_filter3'])
    reply, sausage = cbot.compose_response(
        submission,
        input_key=input_,
        output_filter=output_
        )
    return show_chatbot(submission, reply, sausage)


if __name__ == '__main__':
    cbot = chatbot_brain.Chatbot()
    cbot.fill_lexicon()
    app.run(debug=True)
    #from wsgiref.simple_server import make_server
    #srv = make_server('localhost', 8000, app)
    #srv.serve_forever()
<commit_msg>mde minor changes to views module to accomodate new brain structure<commit_after>from flask import Flask
from flask import g
from flask import render_template
from flask import abort
from flask import request
from flask import url_for
from flask import redirect
from flask import session

import chatbot_brain
from input_filters import input_funcs
from output_filters import funct_dict

app = Flask(__name__)


@app.route('/')
def show_chatbot(submission="...crickets...", reply="Say something to me!",
                 sausage={'default': "I haven't said anything yet..."}):
    """Displays base.html when user goes to main page."""
    return render_template('base.html', reply=reply, sausage=sausage,
                           input_filters=input_funcs,
                           output_filters=funct_dict)


@app.route('/submit', methods=['GET', 'POST'])
def submit():
    """Accepts user submission, creates reply, redirects to homepage."""
    submission = request.form['submission']
    input_ = request.form['input_filter']
    print input_
    output_ = []
    output_.append(request.form['output_filter'])
    output_.append(request.form['output_filter2'])
    output_.append(request.form['output_filter3'])
    reply = cbot.compose_response(
        submission,
        input_key=input_,
        output_filter=output_
        )
    print "Reply: " + str(reply)
    return show_chatbot(submission, reply)


if __name__ == '__main__':
    cbot = chatbot_brain.Chatbot()
    cbot.fill_lexicon()
    app.run(debug=True)
    #from wsgiref.simple_server import make_server
    #srv = make_server('localhost', 8000, app)
    #srv.serve_forever()

{'fraction_non_alphanumeric': 0.10880989180834622, 'fraction_numerical': 0.0037094281298299847, 'mean_word_length': 3.58356940509915, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2153902', 'n_tokens_mistral': 974, 'n_tokens_neox': 937, 'n_words': 251}