-
Notifications
You must be signed in to change notification settings - Fork 1
/
categorizer.js
131 lines (129 loc) · 3.21 KB
/
categorizer.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
const groceries = [
'SPAR',
'TESCO',
'CO-OP',
'LIDL',
'CBA ',
'Mazsa Kalvin',
'BORTàRSASàG ',
'DARLINGTON TEABOLT',
'CULINARIS',
];
const healthcare = ['PATIKA', 'GY.TàR', 'GYòGYSZERTàR', 'GYOGYSZERTAR', 'DATA-OBJECT BT', 'VISION EXPRES'];
const cash = ['ATM '];
const utilities = [
'Google storage',
'BKK ',
'DIJBESZEDÖ ',
'DIGI ',
'Fundamenta',
'SMS CSOMAG',
'IDÖSZAKOS KÖLTSÉGEK',
'TRANZAKCIòS CSOMAG',
'KÖZÖS KÖLTSÉG',
'GENERALI ',
'ELMÜ-ÉMàSZ ',
'ELMUEMASZENERGIASZOLGA',
'TàVHÖ',
'Fötàv',
'FEDEZETLENSÉGI KAMAT',
'Partner NAV Illetékek ',
'BANKKàRTYàVAL KAPCS. DIJ',
'SÉF ASZTALA',
'FIDO',
'Dropbox',
];
const clothing = [
'ZARA ',
'Zara,',
'ZARA.',
'TIZPRBA ',
'PULL ',
'H&M',
'TRIUMPH ',
'MANGO ',
'BERSHKA',
'INTIMISSIMI',
'DECATHLON',
'CALZEDONIA',
'TEZENIS',
'Humanic',
'DRESSMANN',
'HM.COM',
];
const shopping = [
'PAYPAL',
'AMAZON',
'ALIEXPRESS',
'LIBRI',
'PIREX ',
'RELAY ',
'STILE INTERIO',
'PEPCO',
'KIKA ',
'GREEN PAPIR',
'KREATIV HOBBY ',
'IKEA',
'OBI',
'MEDIA MARKT',
'INMEDIO ',
'BESTON-OTTHON',
'JYSK ',
'ZARAHOME.COM',
'BUDAPEST KIRàLY U.52.',
'EMAG.HU',
'WWW.EDIGITAL.HU',
];
const sports = ['Speed-Way', 'ALPINBIKE', 'Radwelt', 'FITNESS'];
const travel = ['M?V', 'Máv ', 'MàV', 'Lokalbah', 'MINIBUD'];
const entertainment = ['CINEMA CITY', 'INTERTICKET ', 'Spotify', 'cinemacity', 'HOTEL PEST KFT', 'SIMPLE'];
const travel_savings = ['Közl UTAZàS'];
const safety_savings = ['Közl BIZTONSàG'];
const personal_care = ['ROSSMANN ', 'DM ', 'Mueller ', 'Harmonia Reformhaz', 'DOUGLAS ', 'TINAMU ', 'BARBER SHOP'];
const restaurant = [
'AMBER',
'Madal Cafe',
'KFC ',
'EIFFEL BISTRO',
'ARRIBA TAQUERIA',
'MADE IN PASTA',
'MCDHU',
'AL DENTE',
'THEBOX DONUT',
'Burger House',
'BAMBA MARHA',
'THAI BT',
'MEDITERRàN GRILL',
'MOST) BISZTR',
'ISTANBUL ÉTTEREM',
'LAZA CAFE',
'BURGER KING',
'SOTE NET',
'ZING BURGER',
'MOST) BISZTR',
'This is Melbourne',
'STOCZEK ETTEREM',
'INFO I ÉTTEREM',
'SZENDVICS DELIKAT KFT.',
'CAFE FREI',
'COSTA COFFEE',
'DUNA TOWER',
];
const categoryMatch = (category, entry) =>
category.some(token => entry.message.toLowerCase().includes(token.toLowerCase()));
export default function(entry) {
if (categoryMatch(groceries, entry)) entry.category = 'Groceries';
if (categoryMatch(healthcare, entry)) entry.category = 'Healthcare';
if (categoryMatch(cash, entry)) entry.category = 'Cash';
if (categoryMatch(utilities, entry)) entry.category = 'Utilities';
if (categoryMatch(clothing, entry)) entry.category = 'Clothing';
if (categoryMatch(entertainment, entry)) entry.category = 'Entertainment';
if (categoryMatch(shopping, entry)) entry.category = 'Shopping';
if (categoryMatch(travel, entry)) entry.category = 'Travel';
if (categoryMatch(travel_savings, entry)) entry.category = 'Travel savings';
if (categoryMatch(safety_savings, entry)) entry.category = 'Safety savings';
if (categoryMatch(personal_care, entry)) entry.category = 'Personal care';
if (categoryMatch(restaurant, entry)) entry.category = 'Restaurant';
if (categoryMatch(sports, entry)) entry.category = 'Sports';
return entry;
}