https://github.com/weaviate-tutorials/crossword-puzzle-generator
Jupyter notebooks to create a crossword puzzle generator
https://github.com/weaviate-tutorials/crossword-puzzle-generator
Last synced: about 1 year ago
JSON representation
Jupyter notebooks to create a crossword puzzle generator
- Host: GitHub
- URL: https://github.com/weaviate-tutorials/crossword-puzzle-generator
- Owner: weaviate-tutorials
- License: bsd-3-clause
- Created: 2024-08-14T16:09:35.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-14T18:18:52.000Z (almost 2 years ago)
- Last Synced: 2025-02-03T18:11:23.086Z (over 1 year ago)
- Language: Jupyter Notebook
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Crossword Puzzle Generator
This repository contains code that creates questions and answers for a topic
that you supply. It uses the question-answer pairs to create a crossword puzzle.
You supply an initial prompt. The code searches a vectorized collection of
Wikipedia data and generates a list of people and places that are associated
with the topic. The list is a list of potential puzzle answers.
Once it has the list of answers, the code searches the Wikipedia collection
again to create a clue for each answer.
Finally, the code passes the list of clues and answers to a puzzle generator.
The puzzle generator creates a crossword puzzle that uses as many of the answers
as it can fit into a puzzle grid.
## Get started
There are two notebooks in the `juypter-notebooks` directory.
### Setup
Use `crossword-setup.ipynb` to create a collection of data based on Wikipedia.
The notebook uses the Simple English subset of the Wikipedia data set from
Cohere.
This is where the language is configured: `import_wiki_data("simple", num_rows, skip_rows)`.
To import a different language, uncomment one of the other import rows or edit
the code to add the language name.
### Generate a puzzle
Use `crossword-create-puzzle.ipynb` to generate the puzzle.
The example code creates a puzzle based on the Harry Potter series. This is the
query prompt: `query="Get the name of a Harry Potter character or the name of a
place associated with Harry Potter"` To change the puzzle topic, edit the query
prompt.
## Requirements
This project uses [Cohere](https://cohere.com/) for the data set and LLM. You
need a Cohere API key to run the code in `crossword-create-puzzle.ipynb`.
## Credits
The code that generates the list of clues and answers is new.
The code that uses the list to generate a puzzle is a lightly modified version
of the [`crossword_helmig`](https://github.com/jeremy886/crossword_helmig)
project.