GithubHelp home page GithubHelp logo

caraneilwarner / pantheon Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 4.0 8.88 MB

A library that procedurally generates Pantheons (Python, nltk, numpy, spaCy)

Home Page: http://pantheon.carawarner.com/

License: GNU General Public License v3.0

Python 100.00%

pantheon's Introduction

pantheon.carawarner.com

Pantheon Generator

PyPI version

This library procedurally generates Gods with internally-coherent domains, and Pantheons comprising generations of Gods that feel related to one another. To achieve a good mix of cohesiveness and novelty, it employs the metaphor of sexual reproduction:

  • Words are chromosomes.
  • A genome is a list of 46 words.
  • A gamete (an egg or sperm) is a list of 23 words.
  • A gene pool is a list of tokens drawn from different texts.
  • Asexual reproduction occurs when a user generates a God from two strings.
  • Sexual reproduction occurs when a user generates a Pantheon from two Gods.

How to Use the Library

python3 -m venv env
source env/bin/activate
pip install pantheon-generator
python -m spacy download en_core_web_md

The user selects two seed words and uses them to generate a God:

God("hunting", "art")

The result is Chetan, God of Illustrators, Prints, and Drawings. The user does this a second time:

God("agriculture", "science")

The result is Kapilla, Goddess of Orchards and Schools. The user combines these two Gods to generate a Pantheon:

Pantheon(Chetan, Kapilla)

The deities reproduce for several generations. The result in a Pantheon with a few dozen Gods in it. One of these is Ajit, Demi-God of Talents, Crafts, and Prancing.

Models

Attributes of a God

  • chromosomes: Either XX or XY.
  • gender: Either male, female, or non_binary.
  • genome: A list of up to 46 words.
  • generation: An integer set during a pantheon.spawn().
  • divinity: Either god, demi_god, or human.
  • name: A string pulled at random from a list of female_names, male_names, or nb_names.
  • epithet: A string that combines a title (God, Goddess, Divine Being, ...) with between 1 and 4 domains. A domain is a word randomly selected from the God's genome. Example: Goddess of hunting and war.
  • parents: The Gods whose egg and sperm combined to create this God.

Attributes of a Pantheon

  • gods: A dictionary mapping names to Gods.

Reproduction

Spawning Gods

Given two Gods, one XX egg donor and one XY sperm donor...

  1. Select a random word from the God.genome of the egg donor.
  2. Use spaCy to pull 23 related words from the gene pool. This is the egg.
  3. Select a random word from the God.genome of the sperm donor.
  4. Use spaCy to pull 23 related words from the gene pool. This is the sperm.
  5. Add the egg and sperm together. This list of 46 words is the genome for the new God.

Note: because a God's genome is populated with words related to seeds from its parents' genomes, a God feels genetically related to its parents. But, because the seeds are selected at random from the parents' genomes, there's room for genetic drift.

Spawning Pantheons

Given two Gods, one XX egg donor and one XY sperm donor, and a number of generations N...

  1. Declare a list of egg donors and a list of sperm donors.
  2. Iterate N times, once for each generation...
  3. At the start of each generation breed the egg donors.
  4. At the end of each generation, add mature offspring to the breeding pool.
  5. At the end of each generation, remove elder Gods from the breeding pool.

Code Imitating Nature

The model blends randomness and probability to echo the beauty of nature.

Gender: There's a 7% chance a God will be transgendered and a 3% chance a God will be non-gendered or gender-queer. For this reason the model refers to 'egg donors' and 'sperm donors' not 'mothers' and 'fathers'. Two male Gods can procreate, as can two female Gods, or a gender-queer God and another God, as long as one parent is XX and one is XY.

Sex: When a new God spawns, its sex chromosomes are chosen at random. It's possible for several Gods in a row to be XX or XY. An unexpected consequence of this: some Pantheons grow much faster than others. The rate of growth is determined by the number of XX gods born in each generation.

Mutation: The related words that spaCy finds in a list of plural nouns often feel "more related" than the ones it finds in a list of gerunds. This is just something I observed. 80% of the time this model pulls gametes from primary_tokens, which is a list of NNS; the other 20% of the time it pulls gametes from secondary_tokens, which is a list of VBG. The result is some children look a lot like their parents and some look very different; there's variety in how far the apple falls from the tree.

Power Level: Many traditions describe old gods as more powerful than young gods. When two Gods procreate there's a 30% chance their offspring will be a 'demi-god' rather than a full blown god. That chance jumps to 50% when a 'god' and 'demi-god' procreate, and when two 'demi-gods' procreate there's a 25% chance their offspring will be a lowly human.

Twinning: 20% of the time coupling produces twins; the other 80% of the time it produces a single child.

Epithets: Most gods (55%) represent 3 domains: God of X, Y, and Z. Slightly fewer gods (35%) represent two domains: God of X and Y. The remaining gods represent 1 or 4 domains.

More Information

Find more information---including example output---see the wiki.

pantheon's People

Contributors

caraneilwarner avatar

Stargazers

Florian Rohrweck avatar Skalimoi avatar Theo avatar  avatar  avatar Claudine Chionh avatar Katrina Pettitt avatar  avatar Prince Kiwii avatar Luis Capelo avatar Shay Palachy-Affek avatar AlexMog avatar Praveen Sridhar avatar Melanie Hoff avatar Doris Zhang avatar Bo Yuan avatar George Herde avatar Kieran Sobel avatar

Watchers

 avatar Theo avatar

pantheon's Issues

example

hey im trying to use this library but unfortunetly i dont known how.

Can u show me a example file where 1 god is generated?
i tried

import pantheon as pantheon
pantheon.tokens.pick_gene_pool("sci-fi")
pantheon.gods.God("hunting", "art")

but i get some errors
eq AttributeError: module 'pantheon' has no attribute 'tokens'

POS Filtering is Imperfect

Challenge

NLTK's part of speech filtering isn't perfect. This leads to some non-sensical results.

The primary tokens list is a list of plural nouns generated by filtering for NNS. It often catches words that end in 's' but aren't plural nouns, such as "becomes" or "hers" or "besides".

The Goddess of Storms makes sense.
The Goddess of Becomes does not.

The secondary tokens list is a list of gerunds generated by filtering for VBG. It sometimes catches adjectives that end in '-ing', such as "interesting".

The God of Hunting makes sense.
The God of Interesting does not.

Solution?

To date, I've been trying to address this by adding mis-tagged words to the stopwords list. This isn't a good solution for several reasons. First, it's manual and therefore incredibly slow. Second, if I ever decide to use ADJ the false gerunds I'm adding to stopwords.txt (such as "interesting") will be suppressed.

Is there a better solution?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.