cwpkd commited on
Commit
83f44c4
·
verified ·
1 Parent(s): ed236f6

Create config.py

Browse files
Files changed (1) hide show
  1. config.py +34 -0
config.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Configuration file for Yahoo Finance News Sentiment Analyzer
2
+
3
+ # Yahoo Finance URLs
4
+ YAHOO_FINANCE_BASE_URL = "https://finance.yahoo.com"
5
+ YAHOO_FINANCE_NEWS_URL = "https://finance.yahoo.com/news/"
6
+
7
+ # Model Configuration
8
+ GEMMA_MODEL_NAME = "google/gemma-2-2b-it" # ใช้ gemma-2-2b แทน เพราะ 4b ไม่มีใน Hugging Face
9
+ SENTIMENT_MODEL_NAME = "ProsusAI/finbert" # Model สำหรับ financial sentiment
10
+
11
+ # Headers for web scraping
12
+ HEADERS = {
13
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
14
+ }
15
+
16
+ # Sentiment mapping
17
+ SENTIMENT_LABELS = {
18
+ 'positive': '😊 Positive',
19
+ 'negative': '😟 Negative',
20
+ 'neutral': '😐 Neutral'
21
+ }
22
+
23
+ # Score mapping
24
+ SCORE_RANGES = {
25
+ 'very_positive': (0.8, 1.0),
26
+ 'positive': (0.6, 0.8),
27
+ 'neutral': (0.4, 0.6),
28
+ 'negative': (0.2, 0.4),
29
+ 'very_negative': (0.0, 0.2)
30
+ }
31
+
32
+ # Default settings
33
+ MAX_NEWS_ITEMS = 10
34
+ DEFAULT_SEARCH_QUERY = "stock market"