Share this article:

Thaki-HWPX v0.1.0 release Thaki-HWPX v0.1.0 release

Parent notices, certificates of merit and official letters in Korean schools mostly travel as Hangul word-processor documents. Getting a generative model to read a request and pull out values such as “issue date December 15, audience all parents” is no longer hard. Turning those values into an HWPX file that a teacher can open right away is a separate step, and someone has to build it.

ThakiCloud has released Thaki-HWPX v0.1.0, a small engine for that last step. It is a Python package that takes field JSON produced by a model and writes an HWPX file.

It uses only the standard library, so it has no runtime dependencies, and it is licensed under Apache-2.0. When we reopened the files generated from five synthetic forms and read the tables back, all 31 fields came back unchanged.

This post covers what the engine takes in and what it produces, why we did not let the model write the document, and what we checked before release as well as what we did not.

Code: github.com/ThakiCloud/thaki-hwpx (tag v0.1.0)

One field JSON becomes a one-page HWPX document

HWPX is Hancom’s document format and follows the Korean national standard OWPML (KS X 6101). It looks like a single file, but inside it is a ZIP package of several XML files. The first entry must be an uncompressed mimetype file, and the body lives in Contents/section0.xml.

The input to Thaki-HWPX is simple: a form name, a title and a list of (item, value) pairs. The output is a one-page A4 .hwpx file with one title paragraph and a two-column “item value” table.

Actual inputs and outputs of the two examples shipped in the repository. Every school, person and number is fictional. Actual inputs and outputs of the two examples shipped in the repository. Every school, person and number is fictional.

Here is the parent-notice example input from the repository (values are Korean because the documents are Korean).

{"fmt": "가정통신문", "title": "2026학년도 겨울방학 생활 안내",
 "fields": [["통지 번호", "통지-2026-4821"], ["대상", "전 학년 학생 및 학부모"], ["발행일", "2026-12-15"],
            ["방학 기간", "2026-12-24 ~ 2027-02-05"], ["문의", "가상초등학교 행정실 000-0000-0000"],
            ["안내", "방학 중 규칙적인 생활과 안전 수칙을 지켜 주시기 바랍니다."]]}

Pass this JSON to python -m thaki_hwpx build and the engine builds the document structure, packages it and runs a structure check. The resulting file is 5,461 bytes. Inside the package are mimetype, version.xml, settings.xml, manifests under META-INF/, the header and body under Contents/, and a preview text file Preview/PrvText.txt.

The second example, model_output_to_hwpx.py, shows the path from model to engine. From a request that begins “Next Wednesday we go on a field trip to a (fictional) science museum”, a model extracts seven fields such as destination, departure time and fee as JSON. The engine takes that JSON and produces a field-trip notice.

With --offline it uses a model output written down in advance, so you can run it without any network.

The model emits fields, the engine builds the document

One could design it so that the model writes the HWPX XML directly. That would make the model responsible for formatting rules every time: ZIP order, XML escaping, matched tags. The same request could also yield different output on each run, which makes it harder to narrow down the cause when a document breaks.

Thaki-HWPX splits the work in two. The model only reads field values from the request and returns them as JSON. The XML and the package are built by deterministic code, meaning code that always gives the same result for the same input. The same JSON produces the same file, down to the byte.

Building HWPX from structured input is not new in itself; existing open-source projects such as python-hwpx, kordoc and hwp-mcp already do it. Thaki-HWPX differs in only three ways: byte-deterministic output, zero runtime dependencies, and a structure checker built separately from the packager.

Thaki-HWPX only takes field JSON from the model. Deterministic code builds the document structure and the package, and a third-party reader reopens the file to read the table values back. Thaki-HWPX only takes field JSON from the model. Deterministic code builds the document structure and the package, and a third-party reader reopens the file to read the table values back.

The pipeline has five stages. It takes structured JSON and builds the document structure as a title paragraph plus a two-column table. It then packages the result as HWPX, following the rule that mimetype comes first and is stored uncompressed.

For pre-release verification we opened the generated files in a third-party reader, rendered them, and read the table values back to confirm they matched the input.

The engine neither loads nor downloads model weights. It touches the network only when a user passes --endpoint to call a model from the example. Values are XML-escaped, control characters forbidden in XML 1.0 are removed, and tabs and line breaks become spaces.

You can install it straight from the GitHub tag.

pip install git+https://github.com/ThakiCloud/thaki-hwpx@v0.1.0
import thaki_hwpx as T
p = T.build_hwpx("가정통신문", [("발행일", "2026-12-15"), ("대상", "전 학년 학부모")], "겨울방학 안내", "out/a.hwpx")
assert T.struct_check(p)["ok"]

Every in-house check and third-party reader check passed before release

Before release we reran verification in fresh virtual environments separated from the source tree. All 8 unit tests passed. The test samples are five forms: a parent notice, a certificate of merit, a summary of the subject-specific remarks in a student record, an official letter, and a special-characters form. All are synthetic, and every person, school and number in them is fictional.

Every in-house check and third-party reader (rhwp) check passed. Opening the files in Hancom Office Hangul itself was not tested. Every in-house check and third-party reader (rhwp) check passed. Opening the files in Hancom Office Hangul itself was not tested.

Check Result
Unit tests (unittest) 8/8 passed
Structure check after generating 5 synthetic forms 5/5
Fields read back from the table 31/31
Open with rhwp 5/5
Field recovery after rhwp HTML render 5/5, fields 31/31
Reopen after rhwp HWP 5 re-save 5/5, fields 31/31
Generate an official letter after pip install git+…@v0.1.0 structure check passed, read-back matched
Open in Hancom Office Hangul not tested

The structure check uses a checker implemented separately from the packager. It confirms that mimetype is the first entry and uncompressed, that all required files are present, and that every XML file parses. It also checks that styles referenced in the body are defined in the header and that each table’s row count matches its declaration.

Running the wheel-installed package from a folder outside the repository gave the same results. The output of the build and check CLI commands was byte-identical to the example output.

For the third-party reader we used rhwp, an independent implementation that aims for Hancom compatibility. It opened all five files, and all 31 fields were recovered from the HTML render. After re-saving in HWP 5 format and reopening, all 31 fields were still there.

Four things to know before you use it

First, we have not opened these files in Hancom Office Hangul itself. We had no environment for it. Passing rhwp does not guarantee Hancom Office compatibility. Please open the files in your own version of Hangul before using them for real work.

Second, we did not run OWPML XSD schema validation. Some elements present in files saved by Hancom Office are missing from this engine’s output, such as paragraph numbering definitions, fill settings, META-INF/container.rdf and the preview image. We do not yet know which of these are actually required.

Third, the range of document layouts is narrow. The engine produces one section with one table. It does not reproduce real education-office layouts with approval boxes, logos, headers or footers. We have not measured visual fidelity such as column widths or line breaks. It also does not parse dates or validate values; it writes the strings it receives as they are.

Fourth, the examples and distribution are still minimal. The runnable examples in the repository are a parent notice and a field-trip notice. The test samples are the five synthetic forms above, and there is no award-recommendation example. The PyPI package has been built and passed twine check, but it has not been uploaded yet. For now, install from the GitHub tag shown above.

This release is engine code only. It contains no model weights and has nothing to do with AI Hub data. All test and example data are synthetic and written by us.

Closing

Thaki-HWPX fills the last stretch between a generative model’s structured output and a Korean administrative document file with deterministic code. The model focuses on extracting the right field values, and the engine owns the file format.

ThakiCloud has documented the engine’s input format as a common document-output spec for ThakiEdu, CompanyOS and Paxis. Today, however, the only code that actually calls the engine is in ThakiEdu.

The first experiment you can run today is short. Install from the tag, change the values in examples/gajeong_tongsin.json, build a file with python -m thaki_hwpx build, and open it in the version of Hangul you use. If it fails to open or the table looks wrong, please tell us through GitHub issues.

Share this article:

Tags: document-generation, education, hwpx, korean, open-source, owpml, structured-output

Categories:

Updated: