Ejemplo n.º 1
0
    def test_inverse_sents(self):
        from sentsem import sentsem

        sent1 = 'Hello, I like playing football!'
        sent2 = 'Greetings, I love playing football!'

        self.assertAlmostEqual(sentsem(sent2, sent1),
                               sentsem(sent1, sent2),
                               delta=0.1)
Ejemplo n.º 2
0
    def test_not_in_vocab(self):
        from sentsem import sentsem

        sent1 = 'I need the email of tuition department'
        sent2 = 'I want to email the tuition department'

        pass_case = sentsem(sent1, sent2) > 0.5
        self.assertTrue(pass_case)
Ejemplo n.º 3
0
    def test_lower_first(self):
        from sentsem import sentsem

        sent1 = 'Hello, I like football'
        sent2 = 'Greetings, I love playing football!'

        pass_case = sentsem(sent1, sent2) > 0.4
        self.assertTrue(pass_case)
Ejemplo n.º 4
0
    def test_not_similar(self):
        from sentsem import sentsem

        sent1 = 'Hello, the sun shines playfully!'
        sent2 = 'Good morning, I love pizza'

        pass_case = sentsem(sent1, sent2) > 0.5

        self.assertFalse(pass_case)
Ejemplo n.º 5
0
    def test_similar(self):
        from sentsem import sentsem

        sent1 = 'Hello, I like playing football!'
        sent2 = 'Greetings, I love playing football!'

        pass_case = sentsem(sent1, sent2) > 0.5

        self.assertTrue(pass_case)
Ejemplo n.º 6
0
    def test_equal(self):
        from sentsem import sentsem

        sent1 = 'Hello, I like playing football!'
        sent2 = 'Hello, I like playing football!'
        self.assertEqual(sentsem(sent1, sent2), 1.0)