Skip to content

Commit 8cf92bc

Browse files
committed
move large sentiment models to separate tests
1 parent a1342cc commit 8cf92bc

File tree

4 files changed

+46
-21
lines changed

4 files changed

+46
-21
lines changed

.github/workflows/nlu_test_flow.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ jobs:
7676
if: always()
7777
run: |
7878
python -m unittest 'tests/nlu_core_tests/component_tests/classifier_tests/sentiment_tests.py'
79+
- name: NLU Classifier Sentiment test Imdb -
80+
if: always()
81+
run: |
82+
python -m unittest 'tests/nlu_core_tests/component_tests/classifier_tests/sentiment_test_imdb.py'
83+
- name: NLU Classifier Sentiment test Twitter -
84+
if: always()
85+
run: |
86+
python -m unittest 'tests/nlu_core_tests/component_tests/classifier_tests/sentiment_test_twitter.py'
7987
- name: NLU Classifier Spam tests -
8088
if: always()
8189
run: |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import unittest
2+
from nlu import *
3+
4+
5+
class TestSentimentImdb(unittest.TestCase):
6+
def test_sentiment_imdb_model(self):
7+
pipe = nlu.load('sentiment.imdb', verbose=True)
8+
df = pipe.predict(['I love pancaces. I hate Mondays',
9+
'I love Fridays'])
10+
print(df.columns)
11+
for c in df.columns: print(df[c])
12+
df = pipe.predict(['I love pancaces. I hate Mondays', 'I love Fridays'],
13+
output_level='document')
14+
print(df.columns)
15+
for c in df.columns: print(df[c])
16+
17+
18+
if __name__ == '__main__':
19+
unittest.main()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import unittest
2+
from nlu import *
3+
4+
5+
class TestSentimentTwitter(unittest.TestCase):
6+
def test_sentiment_twitter_model(self):
7+
pipe = nlu.load('sentiment.twitter', verbose=True)
8+
df = pipe.predict(['I love pancaces. I hate Mondays', 'I love Fridays'],
9+
output_level='sentence')
10+
print(df.columns)
11+
for c in df.columns: print(df[c])
12+
df = pipe.predict(['I love pancaces. I hate Mondays', 'I love Fridays'],
13+
output_level='document')
14+
print(df.columns)
15+
for c in df.columns: print(df[c])
16+
17+
18+
if __name__ == '__main__':
19+
unittest.main()

tests/nlu_core_tests/component_tests/classifier_tests/sentiment_tests.py

-21
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,6 @@ def test_sentiment_model(self):
1010
df = pipe.predict(['I love pancaces. I hate Mondays', 'I love Fridays'], output_level='document',drop_irrelevant_cols=False, metadata=True, )
1111
for c in df.columns: print(df[c])
1212

13-
def test_sentiment_imdb_model(self):
14-
pipe = nlu.load('sentiment.twitter',verbose=True)
15-
df = pipe.predict(['I love pancaces. I hate Mondays', 'I love Fridays'])#, output_level='document',drop_irrelevant_cols=False, metadata=True, )
16-
print(df.columns)
17-
for c in df.columns: print(df[c])
18-
df = pipe.predict(['I love pancaces. I hate Mondays', 'I love Fridays'], output_level='document')
19-
print(df.columns)
20-
for c in df.columns: print(df[c])
21-
22-
23-
24-
def test_sentiment_twitter_model(self):
25-
pipe = nlu.load('sentiment.imdb',verbose=True)
26-
df = pipe.predict(['I love pancaces. I hate Mondays', 'I love Fridays'], output_level='sentence')
27-
print(df.columns)
28-
for c in df.columns: print(df[c])
29-
df = pipe.predict(['I love pancaces. I hate Mondays', 'I love Fridays'], output_level='document')
30-
print(df.columns)
31-
for c in df.columns: print(df[c])
32-
33-
3413
def test_sentiment_detector_model(self):
3514
pipe = nlu.load('sentiment.imdb',verbose=True)
3615
df = pipe.predict(['I love pancaces. I hate Mondays', 'I love Fridays'], output_level='sentence')

0 commit comments

Comments
 (0)