-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
63 lines (50 loc) · 1.25 KB
/
model.py
File metadata and controls
63 lines (50 loc) · 1.25 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from typing import List
from pydantic import BaseModel
class TermDefinition:
def __init__(
self, term: str, definition: str, documents: str, page: int, reason: str
):
self.term = term
self.definition = definition
self.reason = reason
self.documents = documents
self.page = page
def to_dict(self):
return {
"term": self.term,
"definition": self.definition,
"documents": self.documents,
"page": self.page,
}
class DefinitionResult(BaseModel):
term: str
definition: str
documents: str
page: int
class DefinitionResponse(BaseModel):
result: List[DefinitionResult]
class RelationResult(BaseModel):
term1: str
term2: str
relation: str
reason: str
documents: str
page: int
class RelationResponse(BaseModel):
result: List[RelationResult]
class TermRelation:
def __init__(
self,
term1: str,
term2: str,
relation: str,
documents: str,
page: int,
reason: str,
):
self.term1 = term1
self.term2 = term2
self.relation = relation
self.reason = reason
self.documents = documents
self.page = page