File size: 1,264 Bytes
a96145c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
623f05d
 
a96145c
 
 
 
 
 
 
 
 
 
84d1c3c
924fd67
 
 
8914f3e
a96145c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from dataclasses import dataclass, field
from typing import Optional


@dataclass
class RedditPost:
    id: str
    title: str
    url: str
    subreddit: str
    score: int
    num_comments: int
    source_domain: str = ""
    image_url: str = ""
    published: str = ""
    published_iso: str = ""


@dataclass
class Article:
    url: str
    title: str
    text: str
    source_domain: str
    extraction_success: bool = True
    image_url: str = ""
    published: str = ""
    published_iso: str = ""


@dataclass
class Analysis:
    summary: str
    topics: list[str]
    trustworthiness_score: float
    is_opinion: bool
    political_leaning: str = "centrist"
    category: str = "General"
    sponsor: dict = field(default_factory=dict)
    source_bias: str = ""
    source_factuality: str = ""
    article_leaning: str = "centrist"
    sourcing_penalty: float = 0.0


@dataclass
class NewsItem:
    post: RedditPost
    article: Optional[Article] = None
    analysis: Optional[Analysis] = None
    final_score: float = 0.0


@dataclass
class NewsCluster:
    topic: str
    articles: list[NewsItem]
    total_coverage: int
    avg_trustworthiness: float
    avg_popularity: float
    top_post_url: str
    final_score: float = 0.0
    image_url: str = ""