fabricatio 0.2.6__cp39-cp39-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.
Files changed (42) hide show
  1. fabricatio/__init__.py +43 -0
  2. fabricatio/_rust.cp39-win_amd64.pyd +0 -0
  3. fabricatio/_rust.pyi +115 -0
  4. fabricatio/_rust_instances.py +10 -0
  5. fabricatio/actions/article.py +128 -0
  6. fabricatio/actions/output.py +19 -0
  7. fabricatio/actions/rag.py +71 -0
  8. fabricatio/capabilities/correct.py +115 -0
  9. fabricatio/capabilities/propose.py +49 -0
  10. fabricatio/capabilities/rag.py +384 -0
  11. fabricatio/capabilities/rating.py +339 -0
  12. fabricatio/capabilities/review.py +278 -0
  13. fabricatio/capabilities/task.py +113 -0
  14. fabricatio/config.py +405 -0
  15. fabricatio/core.py +181 -0
  16. fabricatio/decorators.py +179 -0
  17. fabricatio/fs/__init__.py +29 -0
  18. fabricatio/fs/curd.py +149 -0
  19. fabricatio/fs/readers.py +46 -0
  20. fabricatio/journal.py +21 -0
  21. fabricatio/models/action.py +230 -0
  22. fabricatio/models/events.py +120 -0
  23. fabricatio/models/extra.py +655 -0
  24. fabricatio/models/generic.py +406 -0
  25. fabricatio/models/kwargs_types.py +169 -0
  26. fabricatio/models/role.py +72 -0
  27. fabricatio/models/task.py +299 -0
  28. fabricatio/models/tool.py +189 -0
  29. fabricatio/models/usages.py +718 -0
  30. fabricatio/models/utils.py +192 -0
  31. fabricatio/parser.py +151 -0
  32. fabricatio/py.typed +0 -0
  33. fabricatio/toolboxes/__init__.py +15 -0
  34. fabricatio/toolboxes/arithmetic.py +62 -0
  35. fabricatio/toolboxes/fs.py +31 -0
  36. fabricatio/workflows/articles.py +26 -0
  37. fabricatio/workflows/rag.py +11 -0
  38. fabricatio-0.2.6.data/scripts/tdown.exe +0 -0
  39. fabricatio-0.2.6.dist-info/METADATA +432 -0
  40. fabricatio-0.2.6.dist-info/RECORD +42 -0
  41. fabricatio-0.2.6.dist-info/WHEEL +4 -0
  42. fabricatio-0.2.6.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,655 @@
1
+ """Extra models for built-in actions."""
2
+
3
+ from typing import List, Self
4
+
5
+ from fabricatio.models.generic import Base, Display, FinalizedDumpAble, PrepareVectorization, ProposedAble
6
+ from pydantic import Field
7
+
8
+
9
+ # <editor-fold desc="ArticleEssence">
10
+ class Equation(Base):
11
+ """Mathematical formalism specification for research contributions.
12
+
13
+ Encodes equations with dual representation: semantic meaning and typeset-ready notation.
14
+ """
15
+
16
+ description: str
17
+ """Equation significance structured in three elements:
18
+ 1. Physical/conceptual meaning
19
+ 2. Role in technical workflow
20
+ 3. Relationship to paper's core contribution
21
+ Example: 'Defines constrained search space dimensionality reduction. Used in architecture optimization phase (Section 3.2). Enables 40% parameter reduction.'"""
22
+
23
+ latex_code: str
24
+ """LaTeX representation following academic typesetting standards:
25
+ - Must use equation environment
26
+ - Multiline equations aligned at '='
27
+ - Unit annotations where applicable
28
+ Example: r'\begin{equation} \\mathcal{L}_{NAS} = \alpha \\|\theta\\|_2 + \beta H(p) \\end{equation}'"""
29
+
30
+
31
+ class Figure(Base):
32
+ """Visual component specification for technical communication.
33
+
34
+ Combines graphical assets with structured academic captioning.
35
+ """
36
+
37
+ description: str
38
+ """Figure interpretation guide containing:
39
+ 1. Key visual elements mapping
40
+ 2. Data representation methodology
41
+ 3. Connection to research findings
42
+ Example: 'Architecture search space topology (left) vs. convergence curves (right). Demonstrates NAS efficiency gains through constrained search.'"""
43
+
44
+ figure_caption: str
45
+ """Complete caption following Nature-style guidelines:
46
+ 1. Brief overview statement (首句总结)
47
+ 2. Technical detail layer
48
+ 3. Result implication
49
+ Example: 'Figure 3: Differentiable NAS framework. (a) Search space topology with constrained dimensions. (b) Training convergence across language pairs. Dashed lines indicate baseline methods.'"""
50
+
51
+ figure_path: str
52
+ """Filesystem path to high-resolution vector graphic (PDF/EPS/SVG).
53
+ Strict validation requirements:
54
+ - Absolute path under /assets/figures/
55
+ - Naming convention: fig[chapter]-[section]_[description].pdf
56
+ Example: '/assets/figures/fig3-2_nas_convergence.pdf'"""
57
+
58
+
59
+ class Highlightings(Base):
60
+ """Technical showcase aggregator for research artifacts.
61
+
62
+ Curates core scientific components with machine-parseable annotations.
63
+ """
64
+
65
+ highlighted_equations: List[Equation] = Field(default_factory=list)
66
+ """3-5 pivotal equations representing theoretical contributions.
67
+ Each must:
68
+ - Use $$ wrapping for display math
69
+ - Contain at least one novel operator/symbol
70
+ - Reference in Methods/Results sections
71
+ Example: Equation describing proposed loss function"""
72
+
73
+ highlighted_algorithms: List[str] = Field(default_factory=list)
74
+ """Algorithm pseudocode following ACM style:
75
+ 1. Numbered steps with bold keywords
76
+ 2. Complexity analysis subsection
77
+ 3. Novel components marked with ※
78
+ Example:
79
+ 'Algorithm 1: Constrained NAS
80
+ 1. Initialize search space with §3.1 constraints ※
81
+ 2. While not converged:
82
+ a. Compute gradient ▽θ
83
+ b. Update architecture parameters...'"""
84
+
85
+ highlighted_figures: List[Figure] = Field(default_factory=list)
86
+ """4-6 key figures demonstrating:
87
+ 1. Framework overview (1 required)
88
+ 2. Quantitative results (2-3 required)
89
+ 3. Ablation studies (1 optional)
90
+ Each must appear in Results/Discussion chapters."""
91
+
92
+ highlighted_tables: List[str] = Field(default_factory=list)
93
+ """Critical data presentations using booktabs format:
94
+ - Minimum 3 comparison baselines
95
+ - Statistical significance markers (*/†/‡)
96
+ - Standard deviation in parentheses
97
+ Example:
98
+ \begin{tabular}{lcc}
99
+ \toprule
100
+ Method & BLEU & Δ Params \\
101
+ \\midrule
102
+ Ours & 32.4 & -41\\%† \\
103
+ \bottomrule
104
+ \\end{tabular}"""
105
+
106
+
107
+ class ArticleEssence(ProposedAble, Display, PrepareVectorization):
108
+ """Semantic fingerprint of academic paper for structured analysis.
109
+
110
+ Encodes research artifacts with dual human-machine interpretability.
111
+ """
112
+ title: str = Field(...)
113
+ """Exact title of the original article without any modification.
114
+ Must be preserved precisely from the source material without:
115
+ - Translation
116
+ - Paraphrasing
117
+ - Adding/removing words
118
+ - Altering style or formatting
119
+ Example: The exact published title as it appears in the original document"""
120
+
121
+ authors: List[str]
122
+ """Original author names exactly as they appear in the source document. No translation or paraphrasing.
123
+ Extract complete list without any modifications or formatting changes."""
124
+
125
+ keywords: List[str]
126
+ """Original keywords exactly as they appear in the source document. No translation or paraphrasing.
127
+ Extract the complete set without modifying format or terminology."""
128
+
129
+ publication_year: int
130
+ """Publication timestamp in ISO 8601 (YYYY format)."""
131
+
132
+ highlightings: Highlightings = Field(default_factory=Highlightings)
133
+ """Technical highlight reel containing:
134
+ - Core equations (Theory)
135
+ - Key algorithms (Implementation)
136
+ - Critical figures (Results)
137
+ - Benchmark tables (Evaluation)"""
138
+
139
+ domain: List[str]
140
+ """Primary research domains from ACM CCS 2023 taxonomy.
141
+ Exactly 2-3 categories required.
142
+ Example: ['Computing methodologies → Machine learning']"""
143
+
144
+ abstract: str = Field(...)
145
+ """Three-paragraph structured abstract:
146
+ Paragraph 1: Problem & Motivation (2-3 sentences)
147
+ Paragraph 2: Methodology & Innovations (3-4 sentences)
148
+ Paragraph 3: Results & Impact (2-3 sentences)
149
+ Total length: 150-250 words"""
150
+
151
+ core_contributions: List[str]
152
+ """3-5 technical contributions using CRediT taxonomy verbs.
153
+ Each item starts with action verb.
154
+ Example:
155
+ - 'Developed constrained NAS framework'
156
+ - 'Established cross-lingual transfer metrics'"""
157
+
158
+ technical_novelty: List[str]
159
+ """Patent-style claims with technical specificity.
160
+ Format: 'A [system/method] comprising [novel components]...'
161
+ Example:
162
+ 'A neural architecture search system comprising:
163
+ a differentiable constrained search space;
164
+ multi-lingual transferability predictors...'"""
165
+
166
+ research_problems: List[str]
167
+ """Problem statements as how/why questions.
168
+ Example:
169
+ - 'How to reduce NAS computational overhead while maintaining search diversity?'
170
+ - 'Why do existing architectures fail in low-resource cross-lingual transfer?'"""
171
+
172
+ limitations: List[str]
173
+ """Technical limitations analysis containing:
174
+ 1. Constraint source (data/method/theory)
175
+ 2. Impact quantification
176
+ 3. Mitigation pathway
177
+ Example:
178
+ 'Methodology constraint: Single-objective optimization (affects 5% edge cases),
179
+ mitigated through future multi-task extension'"""
180
+
181
+ future_work: List[str]
182
+ """Research roadmap items with 3 horizons:
183
+ 1. Immediate extensions (1 year)
184
+ 2. Mid-term directions (2-3 years)
185
+ 3. Long-term vision (5+ years)
186
+ Example:
187
+ 'Short-term: Adapt framework for vision transformers (ongoing with CVPR submission)'"""
188
+
189
+ impact_analysis: List[str]
190
+ """Bibliometric impact projections:
191
+ - Expected citation counts (next 3 years)
192
+ - Target application domains
193
+ - Standard adoption potential
194
+ Example:
195
+ 'Predicted 150+ citations via integration into MMEngine (Alibaba OpenMMLab)'"""
196
+
197
+ def _prepare_vectorization_inner(self) -> str:
198
+ return self.model_dump_json()
199
+
200
+
201
+ # </editor-fold>
202
+
203
+
204
+ class ArticleProposal(ProposedAble, Display):
205
+ """Structured proposal for academic paper development with core research elements.
206
+
207
+ Guides LLM in generating comprehensive research proposals with clearly defined components.
208
+ """
209
+
210
+ title: str = Field(...)
211
+ """Paper title in academic style (Title Case, 8-15 words). Example: 'Exploring Neural Architecture Search for Low-Resource Machine Translation'"""
212
+
213
+ focused_problem: List[str] = Field(default_factory=list)
214
+ """Specific research problem(s) or question(s) addressed (list of 1-3 concise statements).
215
+ Example: ['NAS computational overhead in low-resource settings', 'Architecture transferability across language pairs']"""
216
+
217
+ research_aim: List[str] = Field(default_factory=list)
218
+ """Primary research objectives (list of 2-4 measurable goals).
219
+ Example: ['Develop parameter-efficient NAS framework', 'Establish cross-lingual architecture transfer metrics']"""
220
+
221
+ research_methods: List[str] = Field(default_factory=list)
222
+ """Methodological components (list of techniques/tools).
223
+ Example: ['Differentiable architecture search', 'Transformer-based search space', 'Multi-lingual perplexity evaluation']"""
224
+
225
+ technical_approaches: List[str] = Field(default_factory=list)
226
+
227
+
228
+ # <editor-fold desc="ArticleOutline">
229
+ class ArticleSubsectionOutline(Base):
230
+ """Atomic research component specification for academic paper generation."""
231
+
232
+ title: str = Field(...)
233
+ """Technical focus descriptor following ACL title conventions:
234
+ - Title Case with 4-8 word limit
235
+ - Contains method and domain components
236
+ Example: 'Differentiable Search Space Optimization'"""
237
+
238
+ description: str = Field(...)
239
+ """Tripartite content specification with strict structure:
240
+ 1. Technical Core: Method/algorithm/formalism (1 sentence)
241
+ 2. Structural Role: Placement rationale in section (1 clause)
242
+ 3. Research Value: Contribution to paper's thesis (1 clause)
243
+
244
+ Example: 'Introduces entropy-constrained architecture parameters enabling
245
+ gradient-based NAS. Serves as foundation for Section 3.2. Critical for
246
+ maintaining search space diversity while ensuring convergence.'"""
247
+
248
+
249
+ class ArticleSectionOutline(Base):
250
+ """Methodological unit organizing related technical components."""
251
+
252
+ title: str = Field(...)
253
+ """Process-oriented header with phase identification:
254
+ - Title Case with 5-10 word limit
255
+ - Indicates research stage/methodological focus
256
+ Example: 'Cross-Lingual Evaluation Protocol'"""
257
+
258
+ description: str = Field(...)
259
+ """Functional specification with four required elements:
260
+ 1. Research Stage: Paper progression position
261
+ 2. Technical Innovations: Novel components
262
+ 3. Scholarly Context: Relationship to prior work
263
+ 4. Forward Flow: Connection to subsequent sections
264
+
265
+ Example: 'Implements constrained NAS framework building on Section 2's
266
+ theoretical foundations. Introduces dynamic resource allocation mechanism.
267
+ Directly supports Results section through ablation study parameters.'"""
268
+
269
+ subsections: List[ArticleSubsectionOutline] = Field(..., min_length=3, max_length=5)
270
+ """IMRaD-compliant substructure with technical progression:
271
+ 1. Conceptual Framework
272
+ 2. Methodological Details
273
+ 3. Implementation Strategy
274
+ 4. Validation Approach
275
+ 5. Transition Logic
276
+
277
+ Example Flow:
278
+ [
279
+ 'Search Space Constraints',
280
+ 'Gradient Optimization Protocol',
281
+ 'Multi-GPU Implementation',
282
+ 'Convergence Validation',
283
+ 'Cross-Lingual Extension'
284
+ ]"""
285
+
286
+
287
+ class ArticleChapterOutline(Base):
288
+ """Macro-structural unit implementing standard academic paper organization."""
289
+
290
+ title: str = Field(...)
291
+ """IMRaD-compliant chapter title with domain specification:
292
+ - Title Case with 2-4 word limit
293
+ - Matches standard paper sections
294
+ Example: 'Multilingual Evaluation Results'"""
295
+
296
+ description: str = Field(...)
297
+ """Strategic chapter definition containing:
298
+ 1. Research Phase: Introduction/Methods/Results/etc.
299
+ 2. Chapter Objectives: 3-5 specific goals
300
+ 3. Thesis Alignment: Supported claims/contributions
301
+ 4. Structural Flow: Adjacent chapter relationships
302
+
303
+ Example: 'Presents cross-lingual NAS results across 10 language pairs.
304
+ Validates efficiency claims from Introduction. Provides empirical basis
305
+ for Discussion chapter. Contrasts with single-language baselines.'"""
306
+
307
+ sections: List[ArticleSectionOutline] = Field(..., min_length=3, max_length=5)
308
+ """Standard academic progression implementing chapter goals:
309
+ 1. Context Establishment
310
+ 2. Technical Presentation
311
+ 3. Empirical Validation
312
+ 4. Comparative Analysis
313
+ 5. Synthesis
314
+
315
+ Example Structure:
316
+ [
317
+ 'Experimental Setup',
318
+ 'Monolingual Baselines',
319
+ 'Cross-Lingual Transfer',
320
+ 'Low-Resource Scaling',
321
+ 'Error Analysis'
322
+ ]"""
323
+
324
+
325
+ class ArticleOutline(ProposedAble, Display, FinalizedDumpAble):
326
+ """Complete academic paper blueprint with hierarchical validation."""
327
+
328
+ title: str = Field(...)
329
+ """Full technical title following ACL 2024 guidelines:
330
+ - Title Case with 12-18 word limit
331
+ - Structure: [Method] for [Task] via [Approach] in [Domain]
332
+ Example: 'Efficient Differentiable NAS for Low-Resource MT Through
333
+ Parameter-Sharing: A Cross-Lingual Study'"""
334
+
335
+ prospect: str = Field(...)
336
+ """Consolidated research statement with four pillars:
337
+ 1. Problem Identification: Current limitations
338
+ 2. Methodological Response: Technical approach
339
+ 3. Empirical Validation: Evaluation strategy
340
+ 4. Scholarly Impact: Field contributions
341
+
342
+ Example: 'Addressing NAS computational barriers through constrained
343
+ differentiable search spaces, validated via cross-lingual MT experiments
344
+ across 50+ languages, enabling efficient architecture discovery with
345
+ 60% reduced search costs.'"""
346
+
347
+ chapters: List[ArticleChapterOutline] = Field(..., min_length=5, max_length=8)
348
+ """IMRaD structure with enhanced academic validation:
349
+ 1. Introduction: Problem Space & Contributions
350
+ 2. Background: Theoretical Foundations
351
+ 3. Methods: Technical Innovations
352
+ 4. Experiments: Protocol Design
353
+ 5. Results: Empirical Findings
354
+ 6. Discussion: Interpretation & Limitations
355
+ 7. Conclusion: Synthesis & Future Work
356
+ 8. Appendices: Supplementary Materials"""
357
+
358
+ def finalized_dump(self) -> str:
359
+ """Generates standardized hierarchical markup for academic publishing systems.
360
+
361
+ Implements ACL 2024 outline conventions with four-level structure:
362
+ = Chapter Title (Level 1)
363
+ == Section Title (Level 2)
364
+ === Subsection Title (Level 3)
365
+ ==== Subsubsection Title (Level 4)
366
+
367
+ Returns:
368
+ str: Strictly formatted outline with academic sectioning
369
+
370
+ Example:
371
+ = Methodology
372
+ == Neural Architecture Search Framework
373
+ === Differentiable Search Space
374
+ ==== Constrained Optimization Parameters
375
+ === Implementation Details
376
+ == Evaluation Protocol
377
+ """
378
+ lines: List[str] = []
379
+ for i, chapter in enumerate(self.chapters, 1):
380
+ lines.append(f"= Chapter {i}: {chapter.title}")
381
+ for j, section in enumerate(chapter.sections, 1):
382
+ lines.append(f"== {i}.{j} {section.title}")
383
+ for k, subsection in enumerate(section.subsections, 1):
384
+ lines.append(f"=== {i}.{j}.{k} {subsection.title}")
385
+ return "\n".join(lines)
386
+
387
+
388
+ # </editor-fold>
389
+
390
+
391
+ # <editor-fold desc="Article">
392
+ class Paragraph(ProposedAble):
393
+ """Structured academic paragraph blueprint for controlled content generation."""
394
+
395
+ description: str
396
+ """Functional summary of the paragraph's role in document structure.
397
+ Example: 'Establishes NAS efficiency improvements through differentiable methods'"""
398
+
399
+ writing_aim: List[str]
400
+ """Specific communicative objectives for this paragraph's content.
401
+ Example: ['Introduce gradient-based NAS', 'Compare computational costs',
402
+ 'Link efficiency to practical applications']"""
403
+
404
+ lines: List[str]
405
+ """Hierarchically structured content with enforced rhetorical elements:
406
+ 1. Topic Sentence: Principal claim/position (1 sentence)
407
+ 2. Development: Evidence chain with citations (2-4 sentences)
408
+ 3. Synthesis: Interpretation & significance (1 sentence)
409
+ 4. Transition: Logical bridge to next paragraph (optional)
410
+
411
+ Example: [
412
+ 'Differentiable NAS revolutionized architecture search efficiency.',
413
+ 'DARTS reduced search costs from 2000+ to 4 GPU days (Liu et al., 2019) while maintaining competitive ImageNet accuracy.',
414
+ 'This order-of-magnitude improvement enables NAS deployment in resource-constrained research contexts.',
415
+ 'These efficiency gains directly impact our framework's design choices as detailed in Section 3.'
416
+ ]"""
417
+
418
+
419
+ class SectionRef(ProposedAble):
420
+ """Cross-component reference system for maintaining document consistency."""
421
+
422
+ ref_chapter_title: str
423
+ """Title of referenced chapter (e.g., 'Methodology')"""
424
+
425
+ ref_section_title: str
426
+ """Exact section header text (e.g., '3.2 Gradient Optimization')"""
427
+
428
+ ref_subsection_title: str
429
+ """Specific subsection identifier (e.g., '3.2.1 Learning Rate Scheduling')"""
430
+
431
+
432
+ class ArticleBase(ProposedAble, Display):
433
+ """Foundation for hierarchical document components with dependency tracking."""
434
+
435
+ description: str
436
+ """Functional purpose statement for this component's role in the paper.
437
+ Example: 'Defines evaluation metrics for cross-lingual transfer experiments'"""
438
+
439
+ writing_aim: List[str]
440
+ """Author intentions mapped to rhetorical moves:
441
+ Example: ['Establish metric validity', 'Compare with baseline approaches',
442
+ 'Justify threshold selection']"""
443
+
444
+ title: str = Field(...)
445
+ """Standardized academic header following ACL style guidelines:
446
+ - Title Case with maximal 12-word length
447
+ - No abbreviations without prior definition
448
+ Example: 'Multilingual Benchmark Construction'"""
449
+
450
+ support_to: List[SectionRef]
451
+ """Upstream dependencies requiring this component's validation.
452
+ Format: List of hierarchical references to supported claims/sections
453
+ Example: [SectionRef(chapter='Results', section='4.1', subsection='4.1.2')]"""
454
+
455
+ depend_on: List[SectionRef]
456
+ """Downstream prerequisites for content validity.
457
+ Format: List of references to foundational components
458
+ Example: [SectionRef(chapter='Methods', section='2.3', subsection='2.3.4')]"""
459
+
460
+
461
+ class ArticleSubsection(ArticleBase):
462
+ """Atomic argumentative unit with technical specificity."""
463
+
464
+ title: str = Field(...)
465
+ """Technical descriptor with maximal information density:
466
+ Format: [Method]-[Domain]-[Innovation]
467
+ Example: 'Transformer-Based Architecture Search Space'"""
468
+
469
+ support_to: List[SectionRef]
470
+ """Immediate parent components and supported hypotheses.
471
+ Example: [SectionRef(chapter='Methods', section='3', subsection='3.1')]"""
472
+
473
+ depend_on: List[SectionRef]
474
+ """Technical dependencies including equations, algorithms, and datasets.
475
+ Example: [SectionRef(chapter='Background', section='2.2', subsection='2.2.3')]"""
476
+
477
+ paragraphs: List[Paragraph] = Field(..., min_length=3, max_length=5)
478
+ """Technical exposition following ACM writing guidelines:
479
+ 1. Contextualization: Position in research design
480
+ 2. Technical Detail: Equations/algorithms/code
481
+ 3. Validation: Citations/experimental confirmation
482
+ 4. Interpretation: Scholarly significance
483
+ 5. Transition: Logical connection to subsequent content
484
+
485
+ Example Paragraph Chain:
486
+ [
487
+ 'Our search space builds on standard CNN architectures...',
488
+ 'Formally, we define architecture parameters $\\alpha \\in R^d$ where...',
489
+ 'This parameterization reduces search complexity by 42% compared to...',
490
+ 'The efficiency gains validate our approach to...'
491
+ ]"""
492
+
493
+
494
+ class ArticleSection(ArticleBase):
495
+ """Methodological complete unit presenting cohesive research phase."""
496
+
497
+ title: str = Field(...)
498
+ """Process-oriented header indicating methodological scope.
499
+ Example: 'Cross-Lingual Transfer Evaluation Protocol'"""
500
+
501
+ support_to: List[SectionRef]
502
+ """Supported research questions and paper-level claims.
503
+ Example: [SectionRef(chapter='Introduction', section='1', subsection='1.2')]"""
504
+
505
+ depend_on: List[SectionRef]
506
+ """Required methodological components and theoretical frameworks.
507
+ Example: [SectionRef(chapter='Background', section='2', subsection='2.4')]"""
508
+
509
+ subsections: List[ArticleSubsection] = Field(..., min_length=3, max_length=5)
510
+ """Thematic progression implementing section's research function:
511
+ 1. Conceptual Framework
512
+ 2. Technical Implementation
513
+ 3. Experimental Validation
514
+ 4. Comparative Analysis
515
+ 5. Synthesis
516
+
517
+ Example Subsection Flow:
518
+ [
519
+ 'Evaluation Metrics',
520
+ 'Dataset Preparation',
521
+ 'Baseline Comparisons',
522
+ 'Ablation Studies',
523
+ 'Interpretation Framework'
524
+ ]"""
525
+
526
+
527
+ class ArticleChapter(ArticleBase):
528
+ """Macro-structural unit implementing IMRaD document architecture."""
529
+
530
+ title: str = Field(...)
531
+ """Standard IMRaD chapter title with domain specification.
532
+ Example: 'Neural Architecture Search for Low-Resource Languages'"""
533
+
534
+ support_to: List[SectionRef]
535
+ """Supported thesis statements and paper-level contributions.
536
+ Example: [SectionRef(chapter='Abstract', section='', subsection='')]"""
537
+
538
+ depend_on: List[SectionRef]
539
+ """Foundational chapters and external knowledge prerequisites.
540
+ Example: [SectionRef(chapter='Related Work', section='2', subsection='2.3')]"""
541
+
542
+ sections: List[ArticleSection] = Field(..., min_length=3, max_length=5)
543
+ """Complete research narrative implementing chapter objectives:
544
+ 1. Context Establishment
545
+ 2. Methodology Exposition
546
+ 3. Results Presentation
547
+ 4. Critical Analysis
548
+ 5. Synthesis
549
+
550
+ Example Section Hierarchy:
551
+ [
552
+ 'Theoretical Framework',
553
+ 'Experimental Design',
554
+ 'Results Analysis',
555
+ 'Threats to Validity',
556
+ 'Comparative Discussion'
557
+ ]"""
558
+
559
+
560
+ class Article(ProposedAble, Display):
561
+ """Complete academic paper specification with validation constraints."""
562
+
563
+ title: str = Field(...)
564
+ """Full technical descriptor following ACL 2024 guidelines:
565
+ Structure: [Method] for [Task] in [Domain]: [Subtitle with Technical Focus]
566
+ Example: 'Efficient Differentiable NAS for Low-Resource MT:
567
+ A Parameter-Sharing Approach to Cross-Lingual Transfer'"""
568
+
569
+ abstract: str = Field(...)
570
+ """Structured summary with controlled natural language:
571
+ 1. Context: 2 clauses (problem + gap)
572
+ 2. Methods: 3 clauses (approach + innovation + implementation)
573
+ 3. Results: 3 clauses (metrics + comparisons + significance)
574
+ 4. Impact: 2 clauses (theoretical + practical)
575
+
576
+ Example: 'Neural architecture search (NAS) faces prohibitive... [150 words]'"""
577
+
578
+ chapters: List[ArticleChapter] = Field(..., min_length=5, max_length=8)
579
+ """IMRaD-compliant document structure with enhanced validation:
580
+ 1. Introduction: Motivation & Contributions
581
+ 2. Background: Literature & Theory
582
+ 3. Methods: Technical Implementation
583
+ 4. Experiments: Protocols & Setup
584
+ 5. Results: Empirical Findings
585
+ 6. Discussion: Interpretation & Limitations
586
+ 7. Conclusion: Summary & Future Work
587
+
588
+ Additional: Appendices, Ethics Review, Reproducibility Statements"""
589
+
590
+ def init_from_outline(self, outline: ArticleOutline) -> Self:
591
+ """Initialize the article from a given outline.
592
+
593
+ Args:
594
+ outline (ArticleOutline): The outline to initialize from.
595
+
596
+ Returns:
597
+ Self: The current instance of the article.
598
+ """
599
+ # Set the title from the outline
600
+ self.title = outline.title
601
+
602
+ # Initialize chapters based on outline's chapters
603
+ self.chapters = []
604
+
605
+ for chapter_outline in outline.chapters:
606
+ # Create a new chapter
607
+ chapter = ArticleChapter(
608
+ title=chapter_outline.title,
609
+ description=chapter_outline.description,
610
+ writing_aim=["Implement " + chapter_outline.description],
611
+ support_to=[],
612
+ depend_on=[],
613
+ sections=[],
614
+ )
615
+
616
+ # Create sections for each chapter
617
+ for section_outline in chapter_outline.sections:
618
+ section = ArticleSection(
619
+ title=section_outline.title,
620
+ description=section_outline.description,
621
+ writing_aim=["Address " + section_outline.description],
622
+ support_to=[],
623
+ depend_on=[],
624
+ subsections=[],
625
+ )
626
+
627
+ # Create subsections for each section
628
+ for subsection_outline in section_outline.subsections:
629
+ subsection = ArticleSubsection(
630
+ title=subsection_outline.title,
631
+ description=subsection_outline.description,
632
+ writing_aim=["Explain " + subsection_outline.description],
633
+ support_to=[],
634
+ depend_on=[],
635
+ paragraphs=[
636
+ Paragraph(
637
+ description=f"Implementation of {subsection_outline.title}",
638
+ writing_aim=["Present key concepts", "Support main arguments"],
639
+ lines=[],
640
+ )
641
+ ],
642
+ )
643
+ section.subsections.append(subsection)
644
+
645
+ chapter.sections.append(section)
646
+
647
+ self.chapters.append(chapter)
648
+
649
+ # Generate a placeholder abstract from the outline's prospect
650
+ self.abstract = f"Abstract: {outline.prospect}"
651
+
652
+ return self
653
+
654
+
655
+ # </editor-fold>