File size: 1,182 Bytes
12cdc6e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from dataclasses import dataclass
from typing import Dict

@dataclass
class Config:
    MAX_HISTORY_SIZE: int = 1000
    BATCH_SIZE_LIMIT: int = 50
    MAX_TEXT_LENGTH: int = 512
    MIN_WORD_LENGTH: int = 2
    CACHE_SIZE: int = 128
    BATCH_PROCESSING_SIZE: int = 8
    MODEL_CACHE_SIZE: int = 2  # Maximum models to keep in memory
    
    # Supported languages and models
    SUPPORTED_LANGUAGES = {
        'auto': 'Auto Detect',
        'en': 'English',
        'zh': 'Chinese',
        'es': 'Spanish',
        'fr': 'French',
        'de': 'German',
        'sv': 'Swedish'
    }
    
    MODELS = {
        'en': "cardiffnlp/twitter-roberta-base-sentiment-latest",
        'multilingual': "cardiffnlp/twitter-xlm-roberta-base-sentiment",
        'zh': "uer/roberta-base-finetuned-dianping-chinese"
    }
    
    # Color themes for Plotly
    THEMES = {
        'default': {'pos': '#4CAF50', 'neg': '#F44336', 'neu': '#FF9800'},
        'ocean': {'pos': '#0077BE', 'neg': '#FF6B35', 'neu': '#00BCD4'},
        'dark': {'pos': '#66BB6A', 'neg': '#EF5350', 'neu': '#FFA726'},
        'rainbow': {'pos': '#9C27B0', 'neg': '#E91E63', 'neu': '#FF5722'}
    }

config = Config()