-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
45 lines (37 loc) · 1.88 KB
/
Copy pathconfig.py
File metadata and controls
45 lines (37 loc) · 1.88 KB
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
import os
import logging
from datetime import datetime
RELEVANT_TOPICS = {"finance", "business", "geopolitics", "technology", "economics"}
CANDIDATE_LABELS = list(RELEVANT_TOPICS) + ["sports", "entertainment", "lifestyle", "health", "weather", "other"]
RSS_FEEDS = {
"Yahoo Finance": "https://finance.yahoo.com/rss/topstories",
"CNBC Business": "https://www.cnbc.com/id/10001147/device/rss/rss.html",
"Financial Times": "https://www.ft.com/?format=rss",
"BBC Business": "http://feeds.bbci.co.uk/news/business/rss.xml",
"CNN Politics": "http://rss.cnn.com/rss/cnn_allpolitics.rss",
}
"""
Zero-shot scores rarely concentrate on a single label when a headline
plausibly fits several relevant categories at once (e.g. "business" vs
"economics" vs "finance"), so genuinely relevant stories often have no
single label clearing a high bar even though their combined relevant mass
is high. We therefore sum scores across all RELEVANT_TOPICS labels and
compare that combined mass against MIN_RELEVANT_MASS, rather than gating
on the single top label clearing MIN_TOPIC_SCORE
"""
MIN_RELEVANT_MASS = 0.35
"""
Kept for the cluster-name relevance re-check, which only has a short
LLM-generated phrase to work with and benefits from a slightly looser bar.
"""
MIN_TOPIC_SCORE = 0.35
DISCORD_MAX_LEN = 2000 # discord api limit on chars in a single message
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
LOGS_DIR = os.path.join(BASE_DIR, "logs")
REPORTS_DIR = os.path.join(BASE_DIR, "reports")
os.makedirs(LOGS_DIR, exist_ok=True)
os.makedirs(REPORTS_DIR, exist_ok=True)
LOG_DATE_STR = datetime.now().strftime("%Y-%m-%d")
LOG_PATH = os.path.join(LOGS_DIR, f"Sentibot_{LOG_DATE_STR}.log")
logging.basicConfig(filename=LOG_PATH, level=logging.INFO, format="%(asctime)s %(levelname)-8s %(message)s", datefmt="%Y-%m-%d %H:%M:%S", encoding="utf-8", filemode="w")
logger = logging.getLogger("Sentibot")