File size: 940 Bytes
c149479
 
 
 
 
 
0841c28
c149479
 
 
 
 
 
 
 
 
 
0841c28
c149479
 
 
 
0841c28
 
c149479
 
796eb82
 
 
0841c28
796eb82
 
 
 
0841c28
 
796eb82
 
c149479
 
796eb82
 
 
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
from dataclasses import dataclass


@dataclass
class Paper:
    title: str
    author: str  # People Name1, People Name2: split by `, `
    abstract: str
    url: str
    doi: str
    venue: str
    year: int
    month: int

    def as_dict(self):
        return {
            "title": self.title,
            "author": self.author,
            "abstract": self.abstract,
            "url": self.url,
            "doi": self.doi,
            "venue": self.venue,
            "year": self.year,
            "month": self.month,
        }

    def as_tuple(self) -> tuple:
        return (
            self.title,
            self.author,
            self.abstract,
            self.url,
            self.doi,
            self.venue,
            self.year,
            self.month,
        )

    def __getitem__(self, attr_key: str):
        return getattr(self, attr_key)

    def __hash__(self) -> int:
        return hash(self.as_tuple())