A Text to Wikipedia Generator

jl33.ai
2 min readDec 27, 2023

--

Artifical intelligence is already being used to write entire eBooks and articles, so the natural next step was to write entire Wikipedias.

I know, Wikipedia is struggling as it is, the last thing it needs is something making it even more redundant.

Too bad. I made a GPT-4 wrapper that converts a single text prompt containing a topic into a full sized, interconnected encylopedia with 100+ pages.

There’s two ways of looking at this:

  1. A procedural Wikipedia generator
  2. A text to Wikipedia generator

How it works

  1. A nested dictionary representing the page hierarchy is either pre-defined or generated.
  2. This hierarchy is traversed recursively
  3. For each ‘leaf topic’, a full markdown page is constructed according to predefined set of rules.
Pages being generated
An example page
An example of a Wiki graph
def recursiveFile(parent):
"""Recursively traverses nested dictionairy
Create list -> Parse list -> Generate full Markdown w/ openAI API"""

for topic in parent:
if isInstance(parent[topic], list):
file_name = sanitizeTopicName(topic)
createMDfile(file_name)
else:
recursiveFile(parent[topic])

See the repo

Was this Medium article AI generated? I guess we’ll never know :)

--

--