mydata.py 631 Bytes
Newer Older
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'''
Create a dummy dataset.
Messages with a happy emoticon are labelled positive
Messages with a sad emoticon are labelled negative
'''
import random

dataset = []

vocabulary = ['hello', 'world', 'senpy', 'cool', 'goodbye', 'random', 'text']

emojimap = {
    1: [':)', ],
    -1: [':(', ]
}


for tag, values in emojimap.items():
    for i in range(1000):
        msg = ''
        for j in range(3):
            msg += random.choice(vocabulary)
            msg += " "
        msg += random.choice(values)
        dataset.append([msg, tag])


text = []
labels = []

for i in dataset:
    text.append(i[0])
    labels.append(i[1])