fabricatio 0.2.7.dev3__cp312-cp312-win_amd64.whl → 0.2.7.dev4__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -0,0 +1,192 @@
1
+ """A foundation for hierarchical document components with dependency tracking."""
2
+
3
+ from abc import abstractmethod
4
+ from enum import StrEnum
5
+ from typing import TYPE_CHECKING, List, Optional, Self, Union, final, overload
6
+
7
+ from fabricatio.models.generic import Base, CensoredAble, Display, PersistentAble
8
+ from pydantic import Field
9
+
10
+ if TYPE_CHECKING:
11
+ from fabricatio.models.extra.article_main import Article
12
+ from fabricatio.models.extra.article_outline import ArticleOutline
13
+
14
+
15
+ class ReferringType(StrEnum):
16
+ """Enumeration of different types of references that can be made in an article."""
17
+
18
+ CHAPTER: str = "chapter"
19
+ SECTION: str = "section"
20
+ SUBSECTION: str = "subsection"
21
+
22
+
23
+ class ArticleRef(CensoredAble):
24
+ """Reference to a specific chapter, section or subsection within the article. You SHALL not refer to an article component that is external and not present within our own article.
25
+
26
+ Examples:
27
+ - Referring to a chapter titled `Introduction`:
28
+ Using Python
29
+ ```python
30
+ ArticleRef(referred_chapter_title="Introduction")
31
+ ```
32
+ Using JSON
33
+ ```json
34
+ {referred_chapter_title="Introduction"}
35
+ ```
36
+ - Referring to a section titled `Background` under the `Introduction` chapter:
37
+ Using Python
38
+ ```python
39
+ ArticleRef(referred_chapter_title="Introduction", referred_section_title="Background")
40
+ ```
41
+ Using JSON
42
+ ```json
43
+ {referred_chapter_title="Introduction", referred_section_title="Background"}
44
+ ```
45
+ - Referring to a subsection titled `Related Work` under the `Background` section of the `Introduction` chapter:
46
+ Using Python
47
+ ```python
48
+ ArticleRef(referred_chapter_title="Introduction", referred_section_title="Background", referred_subsection_title="Related Work")
49
+ ```
50
+ Using JSON
51
+ ```json
52
+ {referred_chapter_title="Introduction", referred_section_title="Background", referred_subsection_title="Related Work"}
53
+ ```
54
+ """
55
+
56
+ referred_subsection_title: Optional[str] = None
57
+ """`title` Field of the referenced subsection."""
58
+
59
+ referred_section_title: Optional[str] = None
60
+ """`title` Field of the referenced section."""
61
+
62
+ referred_chapter_title: str
63
+ """`title` Field of the referenced chapter"""
64
+
65
+ def __hash__(self) -> int:
66
+ """Overrides the default hash function to ensure consistent hashing across instances."""
67
+ return hash((self.referred_chapter_title, self.referred_section_title, self.referred_subsection_title))
68
+
69
+ @overload
70
+ def deref(self, article: "Article") -> Optional["ArticleMainBase"]:
71
+ """Dereference the reference to the actual section or subsection within the provided article."""
72
+
73
+ @overload
74
+ def deref(self, article: "ArticleOutline") -> Optional["ArticleOutlineBase"]:
75
+ """Dereference the reference to the actual section or subsection within the provided article."""
76
+
77
+ def deref(
78
+ self, article: Union["ArticleOutline", "Article"]
79
+ ) -> Union["ArticleOutlineBase", "ArticleMainBase", None]:
80
+ """Dereference the reference to the actual section or subsection within the provided article.
81
+
82
+ Args:
83
+ article (ArticleOutline | Article): The article to dereference the reference from.
84
+
85
+ Returns:
86
+ ArticleMainBase | ArticleOutline | None: The dereferenced section or subsection, or None if not found.
87
+ """
88
+ chap = next((chap for chap in article.chapters if chap.title == self.referred_chapter_title), None)
89
+ if self.referred_section_title is None or chap is None:
90
+ return chap
91
+ sec = next((sec for sec in chap.sections if sec.title == self.referred_section_title), None)
92
+ if self.referred_subsection_title is None or sec is None:
93
+ return sec
94
+ return next((subsec for subsec in sec.subsections if subsec.title == self.referred_subsection_title), None)
95
+
96
+ @property
97
+ def referring_type(self) -> ReferringType:
98
+ """Determine the type of reference based on the presence of specific attributes."""
99
+ if self.referred_subsection_title is not None:
100
+ return ReferringType.SUBSECTION
101
+ if self.referred_section_title is not None:
102
+ return ReferringType.SECTION
103
+ return ReferringType.CHAPTER
104
+
105
+
106
+ class SubSectionBase(Base):
107
+ """Base class for article sections and subsections."""
108
+
109
+
110
+ class SectionBase[T: SubSectionBase](Base):
111
+ """Base class for article sections and subsections."""
112
+
113
+ subsections: List[T] = Field(min_length=1)
114
+ """List of subsections, each containing a specific research component. Must contains at least 1 subsection, But do remember you should always add more subsection as required."""
115
+
116
+
117
+ class ChapterBase[T: SectionBase](Base):
118
+ """Base class for article chapters."""
119
+
120
+ sections: List[T] = Field(min_length=1)
121
+ """List of sections, each containing a specific research component. Must contains at least 1 section, But do remember you should always add more section as required."""
122
+
123
+
124
+ class ArticleBase[T: ChapterBase](Base):
125
+ """Base class for article outlines."""
126
+
127
+ chapters: List[T] = Field(min_length=5)
128
+ """List of chapters, each containing a specific research component. Must contains at least 5 chapters, But do remember you should always add more chapter as required."""
129
+
130
+
131
+ class ArticleOutlineBase(Base):
132
+ """Base class for article outlines."""
133
+
134
+ title: str
135
+ """Title of the research component in academic style."""
136
+ description: str
137
+ """Description of the research component in academic style."""
138
+
139
+ support_to: List[ArticleRef]
140
+ """Required: List of all essential ArticleRef objects identifying components this section provides evidence for.
141
+ Format: Each reference must point to a specific chapter, section, or subsection.
142
+ Note: References form a directed acyclic graph in the document structure."""
143
+ depend_on: List[ArticleRef]
144
+ """Required: List of all essential ArticleRef objects identifying components this section builds upon.
145
+ Format: Each reference must point to a previously defined chapter, section, or subsection.
146
+ Note: Circular dependencies are not permitted."""
147
+
148
+ writing_aim: List[str]
149
+ """Required: List of specific rhetorical objectives (3-5 items).
150
+ Format: Each item must be an actionable phrase starting with a verb.
151
+ Example: ['Establish metric validity', 'Compare with baseline approaches',
152
+ 'Justify threshold selection']"""
153
+
154
+
155
+ class ArticleMainBase(CensoredAble, Display, ArticleOutlineBase, PersistentAble):
156
+ """Foundation for hierarchical document components with dependency tracking."""
157
+
158
+ @abstractmethod
159
+ def to_typst_code(self) -> str:
160
+ """Converts the component into a Typst code snippet for rendering."""
161
+
162
+ def _update_pre_check(self, other: Self) -> Self:
163
+ if not isinstance(other, self.__class__):
164
+ raise TypeError(f"Cannot update from a non-{self.__class__} instance.")
165
+ if self.title != other.title:
166
+ raise ValueError("Cannot update from a different title.")
167
+ return self
168
+
169
+ @abstractmethod
170
+ def resolve_update_error(self, other: Self) -> str:
171
+ """Resolve update errors in the article outline.
172
+
173
+ Returns:
174
+ str: Error message indicating update errors in the article outline.
175
+ """
176
+
177
+ @abstractmethod
178
+ def _update_from_inner(self, other: Self) -> Self:
179
+ """Updates the current instance with the attributes of another instance."""
180
+
181
+ @final
182
+ def update_from(self, other: Self) -> Self:
183
+ """Updates the current instance with the attributes of another instance."""
184
+ return self._update_pre_check(other)._update_from_inner(other)
185
+
186
+ def __eq__(self, other: "ArticleMainBase") -> bool:
187
+ """Compares two ArticleBase objects based on their model_dump_json representation."""
188
+ return self.model_dump_json() == other.model_dump_json()
189
+
190
+ def __hash__(self) -> int:
191
+ """Calculates a hash value for the ArticleBase object based on its model_dump_json representation."""
192
+ return hash(self.model_dump_json())
@@ -1,13 +1,22 @@
1
1
  """ArticleBase and ArticleSubsection classes for managing hierarchical document components."""
2
2
 
3
- from abc import abstractmethod
4
3
  from itertools import chain
5
- from typing import Generator, List, Self, Tuple, final
6
-
7
- from fabricatio.models.extra.article_outline import ArticleOutline, ArticleOutlineBase, ArticleRef
4
+ from typing import Generator, List, Self, Tuple
5
+
6
+ from fabricatio.journal import logger
7
+ from fabricatio.models.extra.article_base import (
8
+ ArticleBase,
9
+ ArticleMainBase,
10
+ ArticleRef,
11
+ ChapterBase,
12
+ SectionBase,
13
+ SubSectionBase,
14
+ )
15
+ from fabricatio.models.extra.article_outline import (
16
+ ArticleOutline,
17
+ )
8
18
  from fabricatio.models.generic import CensoredAble, Display, PersistentAble, WithRef
9
19
  from fabricatio.models.utils import ok
10
- from loguru import logger
11
20
 
12
21
 
13
22
  class Paragraph(CensoredAble):
@@ -23,47 +32,7 @@ class Paragraph(CensoredAble):
23
32
  """List of sentences forming the paragraph's content."""
24
33
 
25
34
 
26
- class ArticleBase(CensoredAble, Display, ArticleOutlineBase, PersistentAble):
27
- """Foundation for hierarchical document components with dependency tracking."""
28
-
29
- @abstractmethod
30
- def to_typst_code(self) -> str:
31
- """Converts the component into a Typst code snippet for rendering."""
32
-
33
- def _update_pre_check(self, other: Self) -> Self:
34
- if not isinstance(other, self.__class__):
35
- raise TypeError(f"Cannot update from a non-{self.__class__} instance.")
36
- if self.title != other.title:
37
- raise ValueError("Cannot update from a different title.")
38
- return self
39
-
40
- @abstractmethod
41
- def resolve_update_error(self, other: Self) -> str:
42
- """Resolve update errors in the article outline.
43
-
44
- Returns:
45
- str: Error message indicating update errors in the article outline.
46
- """
47
-
48
- @abstractmethod
49
- def _update_from_inner(self, other: Self) -> Self:
50
- """Updates the current instance with the attributes of another instance."""
51
-
52
- @final
53
- def update_from(self, other: Self) -> Self:
54
- """Updates the current instance with the attributes of another instance."""
55
- return self._update_pre_check(other)._update_from_inner(other)
56
-
57
- def __eq__(self, other: "ArticleBase") -> bool:
58
- """Compares two ArticleBase objects based on their model_dump_json representation."""
59
- return self.model_dump_json() == other.model_dump_json()
60
-
61
- def __hash__(self) -> int:
62
- """Calculates a hash value for the ArticleBase object based on its model_dump_json representation."""
63
- return hash(self.model_dump_json())
64
-
65
-
66
- class ArticleSubsection(ArticleBase):
35
+ class ArticleSubsection(ArticleMainBase, SubSectionBase):
67
36
  """Atomic argumentative unit with technical specificity."""
68
37
 
69
38
  paragraphs: List[Paragraph]
@@ -90,12 +59,9 @@ class ArticleSubsection(ArticleBase):
90
59
  return f"=== {self.title}\n" + "\n\n".join("".join(p.sentences) for p in self.paragraphs)
91
60
 
92
61
 
93
- class ArticleSection(ArticleBase):
62
+ class ArticleSection(ArticleMainBase, SectionBase[ArticleSubsection]):
94
63
  """Atomic argumentative unit with high-level specificity."""
95
64
 
96
- subsections: List[ArticleSubsection]
97
- """List of ArticleSubsection objects containing the content of the section."""
98
-
99
65
  def resolve_update_error(self, other: Self) -> str:
100
66
  """Resolve update errors in the article outline."""
101
67
  if (s_len := len(self.subsections)) == 0:
@@ -131,12 +97,9 @@ class ArticleSection(ArticleBase):
131
97
  return f"== {self.title}\n" + "\n\n".join(subsec.to_typst_code() for subsec in self.subsections)
132
98
 
133
99
 
134
- class ArticleChapter(ArticleBase):
100
+ class ArticleChapter(ArticleMainBase, ChapterBase[ArticleSection]):
135
101
  """Thematic progression implementing research function."""
136
102
 
137
- sections: List[ArticleSection]
138
- """List of ArticleSection objects containing the content of the chapter."""
139
-
140
103
  def resolve_update_error(self, other: Self) -> str:
141
104
  """Resolve update errors in the article outline."""
142
105
  if (s_len := len(self.sections)) == 0:
@@ -166,24 +129,21 @@ class ArticleChapter(ArticleBase):
166
129
  return f"= {self.title}\n" + "\n\n".join(sec.to_typst_code() for sec in self.sections)
167
130
 
168
131
 
169
- class Article(Display, CensoredAble, WithRef[ArticleOutline], PersistentAble):
132
+ class Article(Display, CensoredAble, WithRef[ArticleOutline], PersistentAble, ArticleBase[ArticleChapter]):
170
133
  """Represents a complete academic paper specification, incorporating validation constraints.
171
134
 
172
135
  This class integrates display, censorship processing, article structure referencing, and persistence capabilities,
173
136
  aiming to provide a comprehensive model for academic papers.
174
137
  """
175
138
 
176
- article_language: str
177
- """Written language of the article. SHALL be aligned to the language of the article outline provided."""
139
+ abstract: str
140
+ """Contains a summary of the academic paper."""
178
141
 
179
142
  title: str
180
143
  """Represents the title of the academic paper."""
181
144
 
182
- abstract: str
183
- """Contains a summary of the academic paper."""
184
-
185
- chapters: List[ArticleChapter]
186
- """Contains a list of chapters in the academic paper, each chapter is an ArticleChapter object."""
145
+ language: str
146
+ """Written language of the article. SHALL be aligned to the language of the article outline provided."""
187
147
 
188
148
  def finalized_dump(self) -> str:
189
149
  """Exports the article in `typst` format.
@@ -229,56 +189,30 @@ class Article(Display, CensoredAble, WithRef[ArticleOutline], PersistentAble):
229
189
  article.chapters.append(article_chapter)
230
190
  return article
231
191
 
232
- def chap_iter(self) -> Generator[ArticleChapter, None, None]:
233
- """Iterates over all chapters in the article.
234
-
235
- Yields:
236
- ArticleChapter: Each chapter in the article.
237
- """
238
- yield from self.chapters
239
-
240
- def section_iter(self) -> Generator[ArticleSection, None, None]:
241
- """Iterates over all sections in the article.
242
-
243
- Yields:
244
- ArticleSection: Each section in the article.
245
- """
246
- for chap in self.chapters:
247
- yield from chap.sections
248
-
249
- def subsection_iter(self) -> Generator[ArticleSubsection, None, None]:
250
- """Iterates over all subsections in the article.
251
-
252
- Yields:
253
- ArticleSubsection: Each subsection in the article.
254
- """
255
- for sec in self.section_iter():
256
- yield from sec.subsections
257
-
258
- def iter_dfs(self) -> Generator[ArticleBase, None, None]:
192
+ def iter_dfs(self) -> Generator[ArticleMainBase, None, None]:
259
193
  """Performs a depth-first search (DFS) through the article structure.
260
194
 
261
195
  Returns:
262
- Generator[ArticleBase]: Each component in the article structure.
196
+ Generator[ArticleMainBase]: Each component in the article structure.
263
197
  """
264
- for chap in self.chap_iter():
198
+ for chap in self.chapters:
265
199
  for sec in chap.sections:
266
200
  yield from sec.subsections
267
201
  yield sec
268
202
  yield chap
269
203
 
270
- def deref(self, ref: ArticleRef) -> ArticleBase:
204
+ def deref(self, ref: ArticleRef) -> ArticleMainBase:
271
205
  """Resolves a reference to the corresponding section or subsection in the article.
272
206
 
273
207
  Args:
274
208
  ref (ArticleRef): The reference to resolve.
275
209
 
276
210
  Returns:
277
- ArticleBase: The corresponding section or subsection.
211
+ ArticleMainBase: The corresponding section or subsection.
278
212
  """
279
213
  return ok(ref.deref(self), f"{ref} not found in {self.title}")
280
214
 
281
- def gather_dependencies(self, article: ArticleBase) -> List[ArticleBase]:
215
+ def gather_dependencies(self, article: ArticleMainBase) -> List[ArticleMainBase]:
282
216
  """Gathers dependencies for all sections and subsections in the article.
283
217
 
284
218
  This method should be called after the article is fully constructed.
@@ -292,11 +226,11 @@ class Article(Display, CensoredAble, WithRef[ArticleOutline], PersistentAble):
292
226
 
293
227
  return list(set(depends + supports))
294
228
 
295
- def gather_dependencies_recursive(self, article: ArticleBase) -> List[ArticleBase]:
229
+ def gather_dependencies_recursive(self, article: ArticleMainBase) -> List[ArticleMainBase]:
296
230
  """Gathers all dependencies recursively for the given article.
297
231
 
298
232
  Args:
299
- article (ArticleBase): The article to gather dependencies for.
233
+ article (ArticleMainBase): The article to gather dependencies for.
300
234
 
301
235
  Returns:
302
236
  List[ArticleBase]: A list of all dependencies for the given article.
@@ -335,7 +269,7 @@ class Article(Display, CensoredAble, WithRef[ArticleOutline], PersistentAble):
335
269
 
336
270
  def iter_dfs_with_deps(
337
271
  self, chapter: bool = True, section: bool = True, subsection: bool = True
338
- ) -> Generator[Tuple[ArticleBase, List[ArticleBase]], None, None]:
272
+ ) -> Generator[Tuple[ArticleMainBase, List[ArticleMainBase]], None, None]:
339
273
  """Iterates through the article in a depth-first manner, yielding each component and its dependencies.
340
274
 
341
275
  Args:
@@ -1,134 +1,43 @@
1
1
  """A module containing the ArticleOutline class, which represents the outline of an academic paper."""
2
2
 
3
- from enum import Enum
4
- from typing import TYPE_CHECKING, Generator, List, Optional, Tuple, Union, overload
3
+ from typing import Generator, List, Optional, Tuple, Union
5
4
 
6
5
  import regex
6
+ from fabricatio.models.extra.article_base import (
7
+ ArticleBase,
8
+ ArticleOutlineBase,
9
+ ChapterBase,
10
+ SectionBase,
11
+ SubSectionBase,
12
+ )
7
13
  from fabricatio.models.extra.article_proposal import ArticleProposal
8
- from fabricatio.models.generic import Base, CensoredAble, Display, PersistentAble, WithRef
14
+ from fabricatio.models.generic import CensoredAble, Display, PersistentAble, WithRef
9
15
  from fabricatio.models.utils import ok
10
- from pydantic import Field
11
16
 
12
- if TYPE_CHECKING:
13
- from fabricatio.models.extra.article_main import Article, ArticleBase
14
17
 
15
-
16
- class ReferringType(str, Enum):
17
- """Enumeration of different types of references that can be made in an article."""
18
-
19
- CHAPTER: str = "chapter"
20
- SECTION: str = "section"
21
- SUBSECTION: str = "subsection"
22
-
23
-
24
- class ArticleRef(CensoredAble):
25
- """Reference to a specific chapter, section or subsection within the article. You SHALL not refer to an article component that is external and not present within our own article."""
26
-
27
- referred_chapter_title: str
28
- """`title` Field of the referenced chapter"""
29
-
30
- referred_section_title: Optional[str] = None
31
- """`title` Field of the referenced section. Defaults to None if not applicable, which means the reference is pointing to the entire chapter."""
32
-
33
- referred_subsection_title: Optional[str] = None
34
- """`title` Field of the referenced subsection. Defaults to None if not applicable, which means the reference is pointing to the entire section."""
35
-
36
- def __hash__(self) -> int:
37
- """Overrides the default hash function to ensure consistent hashing across instances."""
38
- return hash((self.referred_chapter_title, self.referred_section_title, self.referred_subsection_title))
39
-
40
- @overload
41
- def deref(self, article: "Article") -> Optional["ArticleBase"]:
42
- """Dereference the reference to the actual section or subsection within the provided article."""
43
-
44
- @overload
45
- def deref(self, article: "ArticleOutline") -> Optional["ArticleOutlineBase"]:
46
- """Dereference the reference to the actual section or subsection within the provided article."""
47
-
48
- def deref(self, article: Union["ArticleOutline", "Article"]) -> Union["ArticleOutlineBase", "ArticleBase", None]:
49
- """Dereference the reference to the actual section or subsection within the provided article.
50
-
51
- Args:
52
- article (ArticleOutline | Article): The article to dereference the reference from.
53
-
54
- Returns:
55
- ArticleBase | ArticleOutline | None: The dereferenced section or subsection, or None if not found.
56
- """
57
- chap = next((chap for chap in article.chapters if chap.title == self.referred_chapter_title), None)
58
- if self.referred_section_title is None or chap is None:
59
- return chap
60
- sec = next((sec for sec in chap.sections if sec.title == self.referred_section_title), None)
61
- if self.referred_subsection_title is None or sec is None:
62
- return sec
63
- return next((subsec for subsec in sec.subsections if subsec.title == self.referred_subsection_title), None)
64
-
65
- @property
66
- def referring_type(self) -> ReferringType:
67
- """Determine the type of reference based on the presence of specific attributes."""
68
- if self.referred_subsection_title is not None:
69
- return ReferringType.SUBSECTION
70
- if self.referred_section_title is not None:
71
- return ReferringType.SECTION
72
- return ReferringType.CHAPTER
73
-
74
-
75
- class ArticleOutlineBase(Base):
76
- """Base class for article outlines."""
77
-
78
- writing_aim: List[str]
79
- """Required: List of specific rhetorical objectives (3-5 items).
80
- Format: Each item must be an actionable phrase starting with a verb.
81
- Example: ['Establish metric validity', 'Compare with baseline approaches',
82
- 'Justify threshold selection']"""
83
- depend_on: List[ArticleRef]
84
- """Required: List of all essential ArticleRef objects identifying components this section builds upon.
85
- Format: Each reference must point to a previously defined chapter, section, or subsection.
86
- Note: Circular dependencies are not permitted."""
87
- support_to: List[ArticleRef]
88
- """Required: List of all essential ArticleRef objects identifying components this section provides evidence for.
89
- Format: Each reference must point to a specific chapter, section, or subsection.
90
- Note: References form a directed acyclic graph in the document structure."""
91
-
92
- description: str
93
- """Description of the research component in academic style."""
94
- title: str
95
- """Title of the research component in academic style."""
96
-
97
-
98
- class ArticleSubsectionOutline(ArticleOutlineBase):
18
+ class ArticleSubsectionOutline(ArticleOutlineBase, SubSectionBase):
99
19
  """Atomic research component specification for academic paper generation."""
100
20
 
101
21
 
102
- class ArticleSectionOutline(ArticleOutlineBase):
22
+ class ArticleSectionOutline(ArticleOutlineBase, SectionBase[ArticleSubsectionOutline]):
103
23
  """A slightly more detailed research component specification for academic paper generation."""
104
24
 
105
- subsections: List[ArticleSubsectionOutline] = Field(min_length=1)
106
- """List of subsections, each containing a specific research component. Must contains at least 1 subsection, But do remember you should always add more subsection as required."""
107
25
 
108
-
109
- class ArticleChapterOutline(ArticleOutlineBase):
26
+ class ArticleChapterOutline(ArticleOutlineBase, ChapterBase[ArticleSectionOutline]):
110
27
  """Macro-structural unit implementing standard academic paper organization."""
111
28
 
112
- sections: List[ArticleSectionOutline] = Field(min_length=1)
113
- """Standard academic progression implementing chapter goals:
114
- 1. Context Establishment
115
- 2. Technical Presentation
116
- 3. Empirical Validation
117
- 4. Comparative Analysis
118
- 5. Synthesis
119
-
120
- Must contains at least 1 sections, But do remember you should always add more section as required.
121
- """
122
-
123
29
 
124
- class ArticleOutline(Display, CensoredAble, WithRef[ArticleProposal], PersistentAble):
30
+ class ArticleOutline(
31
+ Display,
32
+ CensoredAble,
33
+ WithRef[ArticleProposal],
34
+ PersistentAble,
35
+ ArticleBase[ArticleChapterOutline],
36
+ ):
125
37
  """Complete academic paper blueprint with hierarchical validation."""
126
38
 
127
- article_language: str
128
- """Written language of the article. SHALL be aligned to the language of the article proposal provided."""
129
-
130
- title: str
131
- """Title of the academic paper."""
39
+ abstract: str
40
+ """The abstract is a concise summary of the academic paper's main findings."""
132
41
 
133
42
  prospect: str
134
43
  """Consolidated research statement with four pillars:
@@ -136,17 +45,13 @@ class ArticleOutline(Display, CensoredAble, WithRef[ArticleProposal], Persistent
136
45
  2. Methodological Response: Technical approach
137
46
  3. Empirical Validation: Evaluation strategy
138
47
  4. Scholarly Impact: Field contributions
48
+ """
139
49
 
140
- Example: 'Addressing NAS computational barriers through constrained
141
- differentiable search spaces, validated via cross-lingual MT experiments
142
- across 50+ languages, enabling efficient architecture discovery with
143
- 60% reduced search costs.'"""
144
-
145
- chapters: List[ArticleChapterOutline]
146
- """List of ArticleChapterOutline objects representing the academic paper's structure."""
50
+ title: str
51
+ """Title of the academic paper."""
147
52
 
148
- abstract: str
149
- """The abstract is a concise summary of the academic paper's main findings."""
53
+ language: str
54
+ """Written language of the article. SHALL be aligned to the language of the article proposal provided."""
150
55
 
151
56
  def finalized_dump(self) -> str:
152
57
  """Generates standardized hierarchical markup for academic publishing systems.
@@ -214,7 +119,7 @@ class ArticleOutline(Display, CensoredAble, WithRef[ArticleProposal], Persistent
214
119
  cls, typst_code: str, title: str = "", article_language: str = "en", prospect: str = "", abstract: str = ""
215
120
  ) -> "ArticleOutline":
216
121
  """Parses a Typst code string and creates an ArticleOutline instance."""
217
- self = cls(article_language=article_language, prospect=prospect, abstract=abstract, chapters=[], title=title)
122
+ self = cls(language=article_language, prospect=prospect, abstract=abstract, chapters=[], title=title)
218
123
  stack = [self] # 根节点为ArticleOutline实例
219
124
 
220
125
  for line in typst_code.splitlines():
@@ -3,7 +3,6 @@
3
3
  from typing import Dict, List
4
4
 
5
5
  from fabricatio.models.generic import AsPrompt, CensoredAble, Display, PersistentAble, WithRef
6
- from pydantic import Field
7
6
 
8
7
 
9
8
  class ArticleProposal(CensoredAble, Display, WithRef[str], AsPrompt, PersistentAble):
@@ -12,26 +11,25 @@ class ArticleProposal(CensoredAble, Display, WithRef[str], AsPrompt, PersistentA
12
11
  Guides LLM in generating comprehensive research proposals with clearly defined components.
13
12
  """
14
13
 
15
- article_language: str
16
- """Written language of the article. SHALL be aligned to the language of the article briefing provided."""
17
-
18
- title: str = Field(...)
19
- """Paper title in academic style (Title Case, 8-15 words). Example: 'Exploring Neural Architecture Search for Low-Resource Machine Translation'"""
14
+ technical_approaches: List[str]
15
+ """Technical approaches"""
20
16
 
21
- focused_problem: List[str]
22
- """Specific research problem(s) or question(s) addressed (list of 1-3 concise statements).
23
- Example: ['NAS computational overhead in low-resource settings', 'Architecture transferability across language pairs']"""
17
+ research_methods: List[str]
18
+ """Methodological components (list of techniques/tools).
19
+ Example: ['Differentiable architecture search', 'Transformer-based search space', 'Multi-lingual perplexity evaluation']"""
24
20
 
25
21
  research_aim: List[str]
26
22
  """Primary research objectives (list of 2-4 measurable goals).
27
23
  Example: ['Develop parameter-efficient NAS framework', 'Establish cross-lingual architecture transfer metrics']"""
28
24
 
29
- research_methods: List[str]
30
- """Methodological components (list of techniques/tools).
31
- Example: ['Differentiable architecture search', 'Transformer-based search space', 'Multi-lingual perplexity evaluation']"""
25
+ focused_problem: List[str]
26
+ """Specific research problem(s) or question(s) addressed (list of 1-3 concise statements).
27
+ Example: ['NAS computational overhead in low-resource settings', 'Architecture transferability across language pairs']"""
32
28
 
33
- technical_approaches: List[str]
34
- """Technical approaches"""
29
+ title: str
30
+ """Paper title in academic style (Title Case, 8-15 words). Example: 'Exploring Neural Architecture Search for Low-Resource Machine Translation'"""
31
+ language: str
32
+ """Written language of the article. SHALL be aligned to the language of the article briefing provided."""
35
33
 
36
34
  def _as_prompt_inner(self) -> Dict[str, str]:
37
35
  return {"ArticleBriefing": self.referenced, "ArticleProposal": self.display()}