Skip to content

Commit

Permalink
Fixed a upper/lower case issue impacting <that>
Browse files Browse the repository at this point in the history
  • Loading branch information
keiffster committed Dec 7, 2016
1 parent 0e1ec3e commit 123191f
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 62 deletions.
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ http://alicebot.blogspot.co.uk/2013/01/aiml-20-draft-specification-released.html
For full documentation, tutorials and other helpful information, see the GitHub pages site
https://keiffster.github.io/program-y/

This is a version 0.2.0 implementation, it covers almost all the 2.0 grammar and has very high unit test coverage both of code and AIML files along with a better configuration settings and a few other changes. It now also includes external services Pandora, Pannous, Wikipedia and Generic REST
This is a version 0.2.1 implementation, it covers almost all the 2.0 grammar and has very high unit test coverage both of code and AIML files along with a better configuration settings and a few other changes. It now also includes external services Pandora, Pannous, Wikipedia and Generic REST


20 changes: 20 additions & 0 deletions bots/tutorial/aiml/coffee.aiml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

<aiml version="2.0">
<category>
<pattern>I LIKE COFFEE</pattern>
<template>DO YOU TAKE CREAM OR SUGAR IN YOUR COFFEE?</template>
</category>

<category>
<pattern>YES</pattern>
<that>DO YOU TAKE CREAM OR SUGAR IN YOUR COFFEE?</that>
<template>I DO TOO.</template>
</category>

<category>
<pattern>NO</pattern>
<that>DO YOU TAKE CREAM OR SUGAR IN YOUR COFFEE?</that>
<template>REALLY? I HAVE A HARD TIME DRINKING BLACK COFFEE.</template>
</category>
</aiml>
52 changes: 52 additions & 0 deletions bots/tutorial/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

brain:

supress_warnings: true

allow_system_aiml: true
allow_learn_aiml: true
allow_learnf_aiml: true

files:
aiml:
files: $BOT_ROOT/aiml
extension: .aiml
directories: false
sets:
files: $BOT_ROOT/sets
extension: .txt
directories: false
maps:
files: $BOT_ROOT/maps
extension: .txt
directories: false
denormal: $BOT_ROOT/config/denormal.txt
normal: $BOT_ROOT/config/normal.txt
gender: $BOT_ROOT/config/gender.txt
person: $BOT_ROOT/config/person.txt
person2: $BOT_ROOT/config/person2.txt
predicates: $BOT_ROOT/config/predicates.txt
pronouns: $BOT_ROOT/config/pronouns.txt
properties: $BOT_ROOT/config/properties.txt
triples: $BOT_ROOT/config/triples.txt
preprocessors: $BOT_ROOT/config/preprocessors.conf
postprocessors: $BOT_ROOT/config/postprocessors.conf

services:
REST:
path: programy.utils.services.rest.GenericRESTService
Pannous:
path: programy.utils.services.pannous.PannousService
login: test-user
Pandora:
path: programy.utils.services.pandora.PandoraService
botid: f5d922d97e345aa1
Wikipedia:
path: programy.utils.services.wikipediaservice.WikipediaService

bot:
prompt: ">>>"
initial_question: HI, HOW CAN I HELP YOU TODAY?
default_response: SORRY, I DON'T HAVE AN ANSWER FOR THAT!
exit_response: SO LONG, AND THANKS FOR THE FISH!

37 changes: 0 additions & 37 deletions bots/tutorial/config/client.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions bots/tutorial/config/logging.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions bots/tutorial/config/postprocessors.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
programy.processors.post.denormalize.DenormalizePostProcessor
programy.processors.post.cleanup.CleanUpPostProcessor
3 changes: 2 additions & 1 deletion bots/tutorial/config/preprocessors.conf
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
programy.processing.WordPreProcessor
programy.processors.pre.normalize.NormalizePreProcessor
programy.processors.pre.cleanup.CleanUpPreProcessor
17 changes: 17 additions & 0 deletions bots/tutorial/logging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 1
disable_existing_loggers: False

formatters:
simple:
format: '%(asctime)s %(name)-10s %(levelname)-7s %(message)s'

handlers:
file:
class: logging.handlers.RotatingFileHandler
formatter: simple
filename: /tmp/rosiebot.log

root:
level: DEBUG
handlers:
- file
9 changes: 6 additions & 3 deletions src/programy/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,18 @@ def ask_question(self, clientid: str, text: str, srai=False):
else:
parent_question = conversation.current_question()

answers = []
for each_sentence in question._sentences:

response = self.brain.ask_question(self, clientid, each_sentence, parent_question)

if response is not None:
logging.debug("Raw Response (%s): %s"%(clientid, response))
each_sentence.response = self.brain.post_process_response(self, clientid, response).strip()
logging.debug("Processed Response (%s): %s"%(clientid, each_sentence.response))
each_sentence.response = response
answer = self.brain.post_process_response(self, clientid, response).strip()
answers.append(answer)
logging.debug("Processed Response (%s): %s"%(clientid, answer))
else:
each_sentence.response = self.default_response

return question.combine_answers()
return ". ".join([sentence for sentence in answers if sentence is not None])
2 changes: 1 addition & 1 deletion src/programy/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def run(self):
logging.info ("Entering conversation loop...")
running = True
self.display_response(self.bot.get_version_string)
self.display_response(self.bot.initial_question)
self.display_response(self.bot.brain.post_process_response(self.bot, self.clientid, self.bot.initial_question))
while running is True:
try:
question = self.get_question()
Expand Down

0 comments on commit 123191f

Please sign in to comment.