Skip to content

Commit 12b356e

Browse files
committed
feat: adding new schemas
1 parent a545f11 commit 12b356e

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

itext2kg/utils/schemas.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,43 @@ class CV(BaseModel):
9494
skills: List[str] = Field(..., description="List of skills")
9595
certifications: Optional[List[str]] = Field(None, description="List of certifications")
9696
languages: Optional[List[str]] = Field(None, description="List of languages known")
97-
volunteer_work: Optional[List[str]] = Field(None, description="List of volunteer work experiences")
97+
volunteer_work: Optional[List[str]] = Field(None, description="List of volunteer work experiences")
98+
99+
# ---------------------------- News ------------------------------------- #
100+
101+
class Fact(BaseModel):
102+
statement: str = Field(description="A factual statement mentioned in the news article")
103+
source: Optional[str] = Field(description="The source of the fact, if mentioned")
104+
relevance: Optional[str] = Field(description="The relevance or importance of the fact to the overall article")
105+
106+
class ArticleContent(BaseModel):
107+
headline: str = Field(description="The title or headline of the news article")
108+
subheading: Optional[str] = Field(description="The subheading or supporting title of the article")
109+
facts: List[Fact] = Field(description="List of factual statements covered in the article")
110+
keywords: List[str] = Field(description="List of keywords or topics covered in the article")
111+
publication_date: str = Field(description="The publication date of the article")
112+
location: Optional[str] = Field(description="The location relevant to the article")
113+
114+
class NewsArticle(BaseModel):
115+
title: str = Field(description="The title or headline of the news article")
116+
author: Author = Field(description="The author of the article")
117+
content: ArticleContent = Field(description="The body and details of the news article")
118+
119+
# ---------------------------- Novels ------------------------------------- #
120+
class Character(BaseModel):
121+
name: str = Field(description="The name of the character in the novel")
122+
role: str = Field(description="The role of the character in the story, e.g., protagonist, antagonist, etc.")
123+
description: Optional[str] = Field(description="A brief description of the character's background or traits")
124+
125+
class PlotPoint(BaseModel):
126+
chapter_number: int = Field(description="The chapter number where this event occurs")
127+
event: str = Field(description="A significant event or plot point that occurs in the chapter")
128+
129+
class Novel(BaseModel):
130+
title: str = Field(description="The title of the novel")
131+
author: str = Field(description="The author of the novel")
132+
genre: str = Field(description="The genre of the novel")
133+
characters: List[Character] = Field(description="The list of main characters in the novel")
134+
plot_summary: str = Field(description="A brief summary of the overall plot")
135+
key_plot_points: List[PlotPoint] = Field(description="Key plot points or events in the novel")
136+
themes: Optional[List[str]] = Field(description="Main themes explored in the novel, e.g., love, revenge, etc.")

0 commit comments

Comments
 (0)