Ejemplo n.º 1
0
    def test_processing(self):
        if not verbose:
            print('\n --- Testing function get_sentiment_sad() ----')

        result = processing.TextProcessor('Initial text').processing()
        expected = {
            'Subject':
            'john',
            'Predicate':
            'live',
            'Verbs': ['live', 'bear'],
            'Sentance': [
                'john', 'have', 'be', 'live', 'in', 'this', 'city', 'since',
                'he', 'be', 'bear'
            ],
            'Sentiment':
            'neutral',
            'Proper Nouns': ['john'],
            'Noun Phrase': ['john'],
            'Pronouns': ['he']
        }

        self.assertEqual(result, expected)
Ejemplo n.º 2
0
 def test_get_sentiment_happy(self):
     if not verbose:
         print('\n --- Testing function get_sentiment_happy() ----')
     self.assertEqual(
         processing.TextProcessor('Initial text').get_sentiment(0.75),
         'happy')
Ejemplo n.º 3
0
 def test_get_sentiment_sad(self):
     if not verbose:
         print('\n --- Testing function get_sentiment_sad() ----')
     self.assertEqual(
         processing.TextProcessor('Initial text').get_sentiment(-0.1),
         'sad')
Ejemplo n.º 4
0
 def test_word_tag_adv(self):
     if not verbose:
         print('\n --- Testing function word_tag() ----')
     self.assertEqual(
         processing.TextProcessor('Initial text').word_tag(['Hello', 'RB']),
         _wordnet.ADV)