P-Zombie for Python Users

arcanexhuman
2 min readApr 19, 2023

--

“P-Zombie” is a linguistic program — written by me, for Python — which automates the metaphysical process:

Basically, it’s a virtual philosopher without consious faculty.

The countless ways I’ve used this script for my studies, the endless amount of use cases I could think of, and just the general urge to share something useful with my friends; has lead me to release the P-Zombie code, open-source, to anyone who’s interested.

import random
import spacy

#install spaCy using pip: 'pip install spacy' (in terminal)
# Set up the NLP toolkit
nlp = spacy.load(en_core_web_sm")
# Define a list of quotes
QUOTES = [ “”, “”, ]
# Define a list of philosophical propositions
PROPOSITIONS = [ “”, “”, ]
# Define a list of arguments for and against each proposition
ARGUMENTS = {
“”: [
“For:”,
“Against:”,
],
}
# Define a function to generate a random quote
def generate_quote():
return random.choice(QUOTES)

random_quote = random.choice(QUOTES)
# Define a function to generate a philosophical argument for a random proposition
def generate_philosophical_argument():
proposition = random.choice(PROPOSITIONS)
arguments = ARGUMENTS.get(proposition, [])
if not arguments:
# If there are no predefined arguments for the proposition, generate them using NLP *patch*
arguments = generate_arguments(proposition)
return proposition, random.choice(arguments)
print(generate_philosophical_argument())
# Define a function to generate a distilled two-word statement for a random quote
def generate_logic(random_quote):
doc = nlp(random_quote)
for token in doc:
if token.dep_ == “ROOT”:
subject = token.head.text
verb = token
obj = “”
for child in token.children:
if child.dep_ == “dob”:
obj = child.text
return f”{subject} {verb.lemma_} {obj}”
return “”
# Generate two-word statement and print w/quote
for quote in QUOTES:
logic = generate_logic(random_quote)
print(random_quote)
print(logic)
zombie sprite by IronnButterfly

The console output should look something like this (depending on your inputs):

(‘Do we have free will?’, ‘Against: Our choices are determined by factors beyond our control, such as genetics and environment, and therefore free will is an illusion.’)

The greatest wealth is to live content with a steady stream of memes.

is be

...

— ⚔ axh —

--

--