Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codes converted to PEP-8 model #9

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version = 1

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"

[[transformers]]
name = "autopep8"
enabled = true
4 changes: 3 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
app = Flask(__name__)
app.static_folder = 'static'


@app.route("/")
def home():
return render_template("index.html")


@app.route("/get")
def get_bot_response():
userText = request.args.get('msg')
return str(chatbot.get_response(userText))


if __name__ == "__main__":
app.run()
app.run()
13 changes: 7 additions & 6 deletions chatbot.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from chatterbot.trainers import ChatterBotCorpusTrainer
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot

chatbot = ChatBot(
Expand All @@ -9,27 +11,26 @@
'chatterbot.logic.BestMatch',
{
'import_path': 'chatterbot.logic.BestMatch',
'default_response': 'I am sorry, but I do not understand. I am still learning.',
'default_response': 'I am sorry, but I do not understand.\
I am still learning.',
'maximum_similarity_threshold': 0.90
}
],
database_uri='sqlite:///database.sqlite3'
)

# Training With Own Questions
from chatterbot.trainers import ListTrainer

# Training With Own Questions
trainer = ListTrainer(chatbot)

training_data_quesans = open('training_data/ques_ans.txt').read().splitlines()
training_data_personal = open('training_data/personal_ques.txt').read().splitlines()
training_data_personal = open(
'training_data/personal_ques.txt').read().splitlines()

training_data = training_data_quesans + training_data_personal

trainer.train(training_data)

# Training With Corpus
from chatterbot.trainers import ChatterBotCorpusTrainer

trainer_corpus = ChatterBotCorpusTrainer(chatbot)

Expand Down