diff --git a/bots/y-bot/aiml/extensions/wine/recomender.aiml b/bots/y-bot/aiml/extensions/wine/recomender.aiml deleted file mode 100644 index a1d2daf6c..000000000 --- a/bots/y-bot/aiml/extensions/wine/recomender.aiml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - # MY PHONE MINUTES - - - - - - - PHONE MINUTES * - - - - - \ No newline at end of file diff --git a/bots/y-bot/src/extensions/energy/usage.py b/bots/y-bot/src/extensions/energy/usage.py new file mode 100644 index 000000000..177e82a38 --- /dev/null +++ b/bots/y-bot/src/extensions/energy/usage.py @@ -0,0 +1,35 @@ +""" +Copyright (c) 2016 Keith Sterling + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" + +""" +This is an example extension that allow syou to call an external service to retreive the bank balance +of the customer. Currently contains no authentication +""" +import logging + +class BankingBalanceExtension(object): + + # execute() is the interface that is called from the tag in the AIML + def execute(self, data): + logging.debug ("Bank Balance - Calling external service for with extra data [%s]"%(data)) + + # + # Add the logic to receive the balance and format it into pounds and pence and either CREDIT|DEBIT + # + # + + return "0 00 CREDIT" diff --git a/bots/y-bot/src/extensions/wine/__init__.py b/bots/y-bot/src/extensions/survey/__init__.py similarity index 100% rename from bots/y-bot/src/extensions/wine/__init__.py rename to bots/y-bot/src/extensions/survey/__init__.py diff --git a/bots/y-bot/src/extensions/survey/survey.py b/bots/y-bot/src/extensions/survey/survey.py new file mode 100644 index 000000000..b7293ce72 --- /dev/null +++ b/bots/y-bot/src/extensions/survey/survey.py @@ -0,0 +1,35 @@ +""" +Copyright (c) 2016 Keith Sterling + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" + +""" +This is an example extension that allow you to call an external service to retreive the energy consumption data +of the customer. Currently contains no authentication +""" +import logging + +class EnergyUsageExtension(object): + + # execute() is the interface that is called from the tag in the AIML + def execute(self, data): + logging.debug ("Energy Usage - Calling external service for with extra data [%s]"%(data)) + + # + # Add the logic to receive the balance and format it into KWh for Gas and Electricity consumption + # + # + + return "0 0 KWh" diff --git a/bots/y-bot/src/extensions/telecoms/minutes.py b/bots/y-bot/src/extensions/telecoms/minutes.py new file mode 100644 index 000000000..177e82a38 --- /dev/null +++ b/bots/y-bot/src/extensions/telecoms/minutes.py @@ -0,0 +1,35 @@ +""" +Copyright (c) 2016 Keith Sterling + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" + +""" +This is an example extension that allow syou to call an external service to retreive the bank balance +of the customer. Currently contains no authentication +""" +import logging + +class BankingBalanceExtension(object): + + # execute() is the interface that is called from the tag in the AIML + def execute(self, data): + logging.debug ("Bank Balance - Calling external service for with extra data [%s]"%(data)) + + # + # Add the logic to receive the balance and format it into pounds and pence and either CREDIT|DEBIT + # + # + + return "0 00 CREDIT" diff --git a/bots/y-bot/src/test/extensions/energy/__init__.py b/bots/y-bot/src/test/extensions/energy/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/bots/y-bot/src/test/extensions/energy/test_aiml.py b/bots/y-bot/src/test/extensions/energy/test_aiml.py new file mode 100644 index 000000000..3c506f5f1 --- /dev/null +++ b/bots/y-bot/src/test/extensions/energy/test_aiml.py @@ -0,0 +1,25 @@ +import unittest +import os +from test.aiml_tests.client import TestClient +from programy.config.brain import BrainFileConfiguration + + +class BankBalanceTestsClient(TestClient): + + def __init__(self): + TestClient.__init__(self, debug=True) + + def load_configuration(self, arguments): + super(BankBalanceTestsClient, self).load_configuration(arguments) + self.configuration.brain_configuration._aiml_files = BrainFileConfiguration(os.path.dirname(__file__)+"/../../../../aiml/extensions/banking", ".aiml", False) + +class BankBalanceAIMLTests(unittest.TestCase): + + def setUp (self): + BankBalanceAIMLTests.test_client = BankBalanceTestsClient() + + def test_balance(self): + response = BankBalanceAIMLTests.test_client.bot.ask_question("testif", "WHAT IS MY BANK BALANCE") + self.assertIsNotNone(response) + self.assertEqual(response, 'Your bank balance is currently £0.00.') + diff --git a/bots/y-bot/src/test/extensions/energy/test_usage.py b/bots/y-bot/src/test/extensions/energy/test_usage.py new file mode 100644 index 000000000..280c7ed34 --- /dev/null +++ b/bots/y-bot/src/test/extensions/energy/test_usage.py @@ -0,0 +1,14 @@ +import unittest + +from extensions.banking.balance import BankingBalanceExtension + +class BankBalanceExtensionTests(unittest.TestCase): + + def test_balance(self): + + balance = BankingBalanceExtension() + self.assertIsNotNone(balance) + + result = balance.execute("NOW") + self.assertIsNotNone(result) + self.assertEqual("0.00", result) \ No newline at end of file diff --git a/bots/y-bot/src/test/extensions/survey/__init__.py b/bots/y-bot/src/test/extensions/survey/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/bots/y-bot/src/test/extensions/survey/test_aiml.py b/bots/y-bot/src/test/extensions/survey/test_aiml.py new file mode 100644 index 000000000..e257bf054 --- /dev/null +++ b/bots/y-bot/src/test/extensions/survey/test_aiml.py @@ -0,0 +1,25 @@ +import unittest +import os +from test.aiml_tests.client import TestClient +from programy.config.brain import BrainFileConfiguration + + +class TelecomsMinutesTestsClient(TestClient): + + def __init__(self): + TestClient.__init__(self, debug=True) + + def load_configuration(self, arguments): + super(TelecomsMinutesTestsClient, self).load_configuration(arguments) + self.configuration.brain_configuration._aiml_files = BrainFileConfiguration(os.path.dirname(__file__)+"/../../../../aiml/extensions/telecoms", ".aiml", False) + +class TelecomsMinutesAIMLTests(unittest.TestCase): + + def setUp (self): + TelecomsMinutesAIMLTests.test_client = TelecomsMinutesTestsClient() + + def test_balance(self): + response = TelecomsMinutesAIMLTests.test_client.bot.ask_question("testif", "HOW MANY MINUTES DO I HAVE LEFT") + self.assertIsNotNone(response) + self.assertEqual(response, 'This month you have 0 minutes available and have consumed 0 minutes.') + diff --git a/bots/y-bot/src/test/extensions/survey/test_survey.py b/bots/y-bot/src/test/extensions/survey/test_survey.py new file mode 100644 index 000000000..b59cf1429 --- /dev/null +++ b/bots/y-bot/src/test/extensions/survey/test_survey.py @@ -0,0 +1,14 @@ +import unittest + +from extensions.telecoms.minutes import TelecomMinutesExtension + +class BankBalanceExtensionTests(unittest.TestCase): + + def test_balance(self): + + minutes = TelecomMinutesExtension() + self.assertIsNotNone(minutes) + + result = minutes.execute("NOW") + self.assertIsNotNone(result) + self.assertEqual("0 0", result) \ No newline at end of file diff --git a/bots/y-bot/src/test/extensions/telecoms/__init__.py b/bots/y-bot/src/test/extensions/telecoms/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/bots/y-bot/src/test/extensions/telecoms/test_aiml.py b/bots/y-bot/src/test/extensions/telecoms/test_aiml.py new file mode 100644 index 000000000..3c506f5f1 --- /dev/null +++ b/bots/y-bot/src/test/extensions/telecoms/test_aiml.py @@ -0,0 +1,25 @@ +import unittest +import os +from test.aiml_tests.client import TestClient +from programy.config.brain import BrainFileConfiguration + + +class BankBalanceTestsClient(TestClient): + + def __init__(self): + TestClient.__init__(self, debug=True) + + def load_configuration(self, arguments): + super(BankBalanceTestsClient, self).load_configuration(arguments) + self.configuration.brain_configuration._aiml_files = BrainFileConfiguration(os.path.dirname(__file__)+"/../../../../aiml/extensions/banking", ".aiml", False) + +class BankBalanceAIMLTests(unittest.TestCase): + + def setUp (self): + BankBalanceAIMLTests.test_client = BankBalanceTestsClient() + + def test_balance(self): + response = BankBalanceAIMLTests.test_client.bot.ask_question("testif", "WHAT IS MY BANK BALANCE") + self.assertIsNotNone(response) + self.assertEqual(response, 'Your bank balance is currently £0.00.') + diff --git a/bots/y-bot/src/test/extensions/telecoms/test_minutes.py b/bots/y-bot/src/test/extensions/telecoms/test_minutes.py new file mode 100644 index 000000000..280c7ed34 --- /dev/null +++ b/bots/y-bot/src/test/extensions/telecoms/test_minutes.py @@ -0,0 +1,14 @@ +import unittest + +from extensions.banking.balance import BankingBalanceExtension + +class BankBalanceExtensionTests(unittest.TestCase): + + def test_balance(self): + + balance = BankingBalanceExtension() + self.assertIsNotNone(balance) + + result = balance.execute("NOW") + self.assertIsNotNone(result) + self.assertEqual("0.00", result) \ No newline at end of file