Template-based contracts were filled in manually from dozens of spreadsheets — slow and prone to errors. Simple text replacement was not enough: Word splits placeholders across arbitrary XML fragments
SOLUTION
Built an LLM pipeline that analyzes the data structure, identifies mismatches between placeholders and columns, and generates and debugs code
Built a replacement engine that parses paragraphs segment by segment, correctly handling split placeholders and multiple fields within a single paragraph
Set up declarative mapping: a single dictionary connects each placeholder to its data source and can be extended without changing the logic
Handled edge cases including date formats and inconsistent column names
OUTCOMES
A full batch of contracts is generated from the registry in a single run instead of being completed one by one. Word formatting is preserved, and the approach can be reused for any standard contract template