Esempio n. 1
0
    def test_normalize(self):
        processor = NormalizePreProcessor()

        context = ClientContext(TestClient(), "testid")
        context.bot = self.bot
        context.brain = self.bot.brain

        result = processor.process(context, "Hello")
        self.assertIsNotNone(result)
        self.assertEqual("Hello", result)
Esempio n. 2
0
    def test_normalize(self):
        processor = NormalizePreProcessor()

        context = ClientContext(self.client, "testid")
        context.bot = self.bot
        context.brain = self.bot.brain

        result = processor.process(context, "Hello")
        self.assertIsNotNone(result)
        self.assertEqual("Hello", result)
Esempio n. 3
0
    def test_post_cleanup(self):

        test_str = "Hello World"

        normalize_processor = NormalizePreProcessor()
        pass1_str = normalize_processor.process(self.bot, "testid", test_str)
        self.assertEqual("Hello World", pass1_str)

        toupper_processor = ToUpperPreProcessor()
        pass2_str = toupper_processor.process(self.bot, "testid", pass1_str)
        self.assertEqual("HELLO WORLD", pass2_str)
Esempio n. 4
0
    def test_pre_cleanup(self):

        test_str = "Hello World!"

        punctuation_processor = RemovePunctuationPreProcessor()
        pass1_str = punctuation_processor.process(self.bot, "testid", test_str)
        self.assertEqual("Hello World", pass1_str)

        normalize_processor = NormalizePreProcessor()
        pass2_str = normalize_processor.process(self.bot, "testid", pass1_str)
        self.assertEqual("Hello World", pass2_str)

        toupper_processor = ToUpperPreProcessor()
        pass3_str = toupper_processor.process(self.bot, "testid", pass2_str)
        self.assertEqual("HELLO WORLD", pass3_str)
    def test_pre_cleanup(self):

        test_str = "This is my Location!"

        punctuation_processor = RemovePunctuationPreProcessor()
        test_str = punctuation_processor.process(self.bot, "testid", test_str)
        self.assertEqual("This is my Location", test_str)

        normalize_processor = NormalizePreProcessor()
        test_str = normalize_processor.process(self.bot, "testid", test_str)
        self.assertEqual("This is my Location", test_str)

        toupper_processor = ToUpperPreProcessor()
        test_str = toupper_processor.process(self.bot, "testid", test_str)
        self.assertEqual("THIS IS MY LOCATION", test_str)
Esempio n. 6
0
    def test_pre_cleanup(self):

        context = ClientContext(TestClient(), "testid")
        context.bot = Bot(config=BotConfiguration())
        context.brain = context.bot.brain
        test_str = "This is my Location!"

        punctuation_processor = RemovePunctuationPreProcessor()
        test_str = punctuation_processor.process(context, test_str)
        self.assertEqual("This is my Location", test_str)

        normalize_processor = NormalizePreProcessor()
        test_str = normalize_processor.process(context, test_str)
        self.assertEqual("This is my Location", test_str)

        toupper_processor = ToUpperPreProcessor()
        test_str = toupper_processor.process(context, test_str)
        self.assertEqual("THIS IS MY LOCATION", test_str)
Esempio n. 7
0
    def test_pre_cleanup(self):

        context = ClientContext(TestClient(), "testid")
        context.bot = Bot(config=BotConfiguration())
        context.brain = context.bot.brain
        test_str = "This is my Location!"

        punctuation_processor = RemovePunctuationPreProcessor()
        test_str = punctuation_processor.process(context, test_str)
        self.assertEqual("This is my Location", test_str)

        normalize_processor = NormalizePreProcessor()
        test_str = normalize_processor.process(context, test_str)
        self.assertEqual("This is my Location", test_str)

        toupper_processor = ToUpperPreProcessor()
        test_str = toupper_processor.process(context, test_str)
        self.assertEqual("THIS IS MY LOCATION", test_str)

        demojize_processpr = DemojizePreProcessor()
        test_str = demojize_processpr.process(context, test_str)
        self.assertEqual(test_str, test_str)
    def test_pre_cleanup(self):
        self.client = TestClient()

        context = ClientContext(self.client, "testid")

        config = BotConfiguration()

        config.from_translator._classname = "programy.translate.textblob_translator.TextBlobTranslator"
        config.from_translator._from_lang = "fr"
        config.from_translator._to_lang = "en"

        config.to_translator._classname = "programy.translate.textblob_translator.TextBlobTranslator"
        config.to_translator._from_lang = "en"
        config.to_translator._to_lang = "fr"

        context.bot = Bot(config=config, client=self.client)
        context.brain = context.bot.brain
        test_str = "Ceci est mon emplacement!"

        translate_processor = TranslatorPreProcessor()
        test_str = translate_processor.process(context, test_str)
        self.assertEqual("This is my location!", test_str)

        punctuation_processor = RemovePunctuationPreProcessor()
        test_str = punctuation_processor.process(context, test_str)
        self.assertEqual("This is my location!", test_str)

        normalize_processor = NormalizePreProcessor()
        test_str = normalize_processor.process(context, test_str)
        self.assertEqual("This is my location!", test_str)

        toupper_processor = ToUpperPreProcessor()
        test_str = toupper_processor.process(context, test_str)
        self.assertEqual("THIS IS MY LOCATION!", test_str)

        demojize_processpr = DemojizePreProcessor()
        test_str = demojize_processpr.process(context, test_str)
        self.assertEqual(test_str, test_str)
Esempio n. 9
0
    def test_normalize(self):
        processor = NormalizePreProcessor()

        result = processor.process(self.bot, "testid", "Hello")
        self.assertIsNotNone(result)
        self.assertEqual("Hello", result)
Esempio n. 10
0
    def test_normalize(self):
        processor = NormalizePreProcessor()

        result = processor.process(self.bot, "testid", "Hello")
        self.assertIsNotNone(result)
        self.assertEqual("Hello", result)