コード例 #1
0
ファイル: tests.py プロジェクト: reyesj5/moodzaic
 def test_setEmotions(self):
     emotions = ['Love', 'Sad', 'Hesitant', 'Calm', 'Happy']
     model1 = MoodNeuralNetwork()
     emotions2 = model1.getEmotions()
     self.assertNotEqual(emotions, emotions2)
     self.assertTrue(model1.setEmotions(emotions))
     self.assertEqual(emotions, model1.getEmotions())
コード例 #2
0
ファイル: tests.py プロジェクト: reyesj5/moodzaic
 def test_getEmotions(self):
     emotions = getEmotions()
     model1 = MoodNeuralNetwork()
     emotions2 = model1.getEmotions()
     self.assertEqual(emotions, emotions2)
     self.assertTrue(model1.getEmotions())
コード例 #3
0
import json

from mood_model.mood_neural_network import MoodNeuralNetwork

baseModel = MoodNeuralNetwork()
emotions = baseModel.getEmotions()
emotion_map = {}
for i in range(len(emotions)):
    emotion_map[emotions[i]] = i

with open('notifications.txt',
          'r') as file:  # Use file to refer to the file object
    data = file.read().splitlines()
print(data)
reminders = {}
curr = ""
for i in range(len(data)):
    if data[i] in emotion_map:
        reminders[data[i]] = []
        curr = data[i]
    else:
        reminders[curr].append(data[i])
print(reminders)
print(reminders['Sad'])
with open('notifications.json', 'w') as fp:
    json.dump(reminders, fp)