-
Notifications
You must be signed in to change notification settings - Fork 5
/
utils.py
41 lines (32 loc) · 974 Bytes
/
utils.py
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
import json
import re
import emoji
BANNED_USERS = "banned_users"
BANNED_WORDS = "banned_words"
CONSUMER_KEY = "consumer_key"
CONSUMER_SECRET = "consumer_secret"
ACCESS_KEY = "access_key"
ACCESS_SECRET = "access_secret"
BEARER_TOKEN = "bearer_token"
RESEARCH = "research"
TAG_SENTENCES = "tag_sentences"
TAG_USERS = "tag_users"
SOL_ADDR = "sol_address"
ETH_ADDR = "eth_address"
CREDENTIALS = "credentials"
def load_configfile(filename):
with open(filename) as file:
data = json.load(file)
config = {
BANNED_USERS: data[BANNED_USERS],
BANNED_WORDS: data[BANNED_WORDS],
RESEARCH : data[RESEARCH],
TAG_SENTENCES : data[TAG_SENTENCES],
TAG_USERS : data[TAG_USERS],
SOL_ADDR : data[SOL_ADDR],
ETH_ADDR : data[ETH_ADDR],
CREDENTIALS : data[CREDENTIALS]
}
return config
def remove_emoji(text):
return emoji.get_emoji_regexp().sub(u'', text)