Exemplo n.º 1
0
 def test_nounlike_noun(self):
     noun_word = Word(u"dog", u"dog", u"NN")
     output = semantic_utils.handle_nounlike(noun_word)
     self.assertIsInstance(output, HasKeyword)
     noun_word = Word(u"dog", u"dog", u"NNP")
     output = semantic_utils.handle_nounlike(noun_word)
     self.assertIsInstance(output, HasKeyword)
Exemplo n.º 2
0
 def test_nounlike_noun(self):
     noun_word = Word(u"dog", u"dog", u"NN")
     output = semantic_utils.handle_nounlike(noun_word)
     self.assertIsInstance(output, HasKeyword)
     noun_word = Word(u"dog", u"dog", u"NNP")
     output = semantic_utils.handle_nounlike(noun_word)
     self.assertIsInstance(output, HasKeyword)
Exemplo n.º 3
0
    def test_nounlike_handler(self):
        from quepy import handlers

        class DogType(FixedType):
            fixedtype = "dog"

        class MyHandler(handlers.Handler):
            def check(self, word):
                return word.lemma == "special_dog"

            def handler(self, word):
                return DogType()

        handlers.register(MyHandler)
        noun_word = Word(u"lazzy", u"special_dog", u"NN")
        output = semantic_utils.handle_nounlike(noun_word)
        self.assertIsInstance(output, DogType)
Exemplo n.º 4
0
    def test_nounlike_handler(self):
        from quepy import handlers

        class DogType(FixedType):
            fixedtype = "dog"

        class MyHandler(handlers.Handler):
            def check(self, word):
                return word.lemma == "special_dog"

            def handler(self, word):
                return DogType()

        handlers.register(MyHandler)
        noun_word = Word(u"lazzy", u"special_dog", u"NN")
        output = semantic_utils.handle_nounlike(noun_word)
        self.assertIsInstance(output, DogType)