Dataset Viewer
Duplicate
The dataset viewer is not available for this split.
Cannot load the dataset split (in streaming mode) to extract the first rows.
Error code:   StreamingRowsError
Exception:    CastError
Message:      Couldn't cast
experiment: string
method: string
model: string
generated_at: string
total_chapters: int64
total_chars: int64
api_calls_per_chapter: int64
api_calls_total: int64
chapters: list<item: struct<chapter_id: string, title: string, char_count: int64>>
  child 0, item: struct<chapter_id: string, title: string, char_count: int64>
      child 0, chapter_id: string
      child 1, title: string
      child 2, char_count: int64
total_tokens: int64
api_calls: int64
to
{'experiment': Value('string'), 'method': Value('string'), 'model': Value('string'), 'generated_at': Value('string'), 'total_chapters': Value('int64'), 'total_chars': Value('int64'), 'total_tokens': Value('int64'), 'api_calls': Value('int64'), 'chapters': List({'chapter_id': Value('string'), 'title': Value('string'), 'char_count': Value('int64'), 'tokens_used': Value('int64')})}
because column names don't match
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/utils.py", line 147, in get_rows_or_raise
                  return get_rows(
                      dataset=dataset,
                  ...<4 lines>...
                      column_names=column_names,
                  )
                File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
                  return func(*args, **kwargs)
                File "/src/services/worker/src/worker/utils.py", line 127, in get_rows
                  rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
                File "/src/services/worker/src/worker/utils.py", line 483, in safe_iter
                  yield from ds.decode(False) if ds.features else ds
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2840, in __iter__
                  for key, example in ex_iterable:
                                      ^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2373, in __iter__
                  for key, pa_table in self._iter_arrow():
                                       ~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2398, in _iter_arrow
                  for key, pa_table in self.ex_iterable._iter_arrow():
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 536, in _iter_arrow
                  for key, pa_table in iterator:
                                       ^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 419, in _iter_arrow
                  for key, pa_table in self.generate_tables_fn(**gen_kwags):
                                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 343, in _generate_tables
                  self._cast_table(pa_table, json_field_paths=json_field_paths),
                  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2378, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2306, in cast_table_to_schema
                  raise CastError(
                  ...<3 lines>...
                  )
              datasets.table.CastError: Couldn't cast
              experiment: string
              method: string
              model: string
              generated_at: string
              total_chapters: int64
              total_chars: int64
              api_calls_per_chapter: int64
              api_calls_total: int64
              chapters: list<item: struct<chapter_id: string, title: string, char_count: int64>>
                child 0, item: struct<chapter_id: string, title: string, char_count: int64>
                    child 0, chapter_id: string
                    child 1, title: string
                    child 2, char_count: int64
              total_tokens: int64
              api_calls: int64
              to
              {'experiment': Value('string'), 'method': Value('string'), 'model': Value('string'), 'generated_at': Value('string'), 'total_chapters': Value('int64'), 'total_chars': Value('int64'), 'total_tokens': Value('int64'), 'api_calls': Value('int64'), 'chapters': List({'chapter_id': Value('string'), 'title': Value('string'), 'char_count': Value('int64'), 'tokens_used': Value('int64')})}
              because column names don't match

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

EKG-Writer

Structured long-form story generation with a five-layer Event Knowledge Graph (EKG).

This repository is the research code and materials accompanying the paper "Controllable story generation with event knowledge graphs: an exploratory case study of human-AI long-form narrative writing" (submitted to Natural Language Processing, Cambridge University Press).

What is EKG-Writer?

EKG-Writer is a research prototype for structured AI story generation. It uses a five-layer Event Knowledge Graph (EKG) as an editable story blueprint, then drives a GPT-5 pipeline to produce chapter-level Chinese prose with automatic cross-chapter consistency tracking. The test domain is Chinese folkloric adventure-mystery genre fiction, chosen because the genre places strong demands on style, domain-knowledge, and long-range structural control.

This repository contains the method, code, EKG schema, prompt templates, de-identified evaluation scores, and analysis scripts only. It does not distribute generated narrative text.

Key features

  • Five-layer EKG structure - L0 (premise) -> L1 (arc) -> L2 (chapter key event) -> L3 (scene) -> L4 (inter-chapter bridge). Human authors write L0-L2; the system expands L3-L4.
  • Cross-chapter state tracking - a running state (confirmed facts, unresolved foreshadowing, character status, props, current location) updated per chapter and re-injected into later scene prompts.
  • post_review quality filter - detects and rewrites vague psychological placeholders, summary endings, out-of-POV narration, and AI-style rhetorical questions.
  • A/B/C/D ablation design - incremental conditions for reproducible comparison.

Repository structure

scripts/    novel_writer.py (main pipeline), seed_tree.py
core/       exporter.py, node_templates.py (EKG schema), style_control.py
data/       prompts/ (prompt templates)
analysis/   evaluation_scores.csv (de-identified), stats_table4.py

Quick start

cp .env.example .env      # add your OPENAI_API_KEY
pip install -r requirements.txt
python scripts/novel_writer.py --ekg <your_ekg_file>.json --node L2-A1-001 --experiment D

Requires Python 3.10-3.12 and an OpenAI API key with GPT-5 access.

Citation

If you use this code, please cite the accompanying paper (Hou et al., forthcoming, Natural Language Processing, Cambridge University Press).

License

Source code: MIT License.

Downloads last month
133