Ejemplo n.º 1
0
    def test_combine_answers(self):

        config = BotSentenceJoinerConfiguration()
        self.assertIsNotNone(config)
        config._classname = 'programy.dialog.joiner.joiner_jp.SentenceJoiner'
        config._join_chars = '.?!。?!'
        config._terminator = '。'

        joiner = SentenceJoiner.initiate_sentence_joiner(config)
        self.assertIsNotNone(joiner)

        self.assertEquals("", joiner.combine_answers([""], False))

        self.assertEquals("this is a pen。",
                          joiner.combine_answers(["this is a pen"], False))
        self.assertEquals("こんにちは。", joiner.combine_answers(["こんにちは"], False))
        self.assertEquals("this is a pen.",
                          joiner.combine_answers(["this is a pen."], False))
        self.assertEquals("こんにちは。", joiner.combine_answers(["こんにちは。"], False))
        self.assertEquals("is this a pen?",
                          joiner.combine_answers(["is this a pen?"], False))
        self.assertEquals("こんにちは?", joiner.combine_answers(["こんにちは?"], False))
        self.assertEquals("is this a pen!",
                          joiner.combine_answers(["is this a pen!"], False))
        self.assertEquals("こんにちは!", joiner.combine_answers(["こんにちは!"], False))
Ejemplo n.º 2
0
    def test_initiate_class_none(self):

        config = BotSentenceJoinerConfiguration()
        self.assertIsNotNone(config)
        config._classname = None

        joiner = SentenceJoiner.initiate_sentence_joiner(config)
        self.assertIsNone(joiner)
Ejemplo n.º 3
0
    def test_initiate_class_none(self):

        config = BotSentenceJoinerConfiguration()
        self.assertIsNotNone(config)
        config._classname = None
        config._join_chars = '.?!。?!'
        config._terminator = '。'

        joiner = SentenceJoiner.initiate_sentence_joiner(config)
        self.assertIsNone(joiner)
Ejemplo n.º 4
0
    def test_initiate_joiner(self):

        config = BotSentenceJoinerConfiguration()
        self.assertIsNotNone(config)
        config._classname = 'programy.dialog.joiner.joiner_jp.SentenceJoiner'
        config._join_chars = '.?!。?!'
        config._terminator = '。'

        joiner = SentenceJoiner.initiate_sentence_joiner(config)
        self.assertIsNotNone(joiner)
        self.assertIsInstance(joiner, SentenceJoiner)