Copied code installation Mundaneum, English version
parent
dbe02f7ead
commit
30bd684622
@ -0,0 +1,31 @@
|
||||
# Growing a Tree
|
||||
|
||||
Parts-of-Speech is a category of words that we learn at school: noun, verb, adjective, adverb, pronoun, preposition, conjunction, interjection, and sometimes numeral, article, or determiner.
|
||||
|
||||
In Natural Language Processing (NLP) there exist many writings that allow sentences to be parsed. This means that the algorithm can determine the part-of-speech of each word in a sentence. 'Growing a tree' uses this techniques to define all nouns in a specific sentence. Each noun is then replaced by its definition. This allows the sentence to grow autonomously and infinitely. The recipe of 'Growing a tree' was inspired by Oulipo's constraint of ['Littérature définitionnelle'](http://oulipo.net/fr/contraintes/litterature-definitionnelle), invented by Marcel Benabou in 1966. In a given phrase, one replaces every significant element (noun, adjective, verb, adverb) by one of its definitions in a given dictionary ; one reiterates the operation on the newly received phrase, and again.
|
||||
|
||||
The dictionary of definitions used in this work is Wordnet. Wordnet is a combination of a dictionary and a thesaurus that can be read by machines. According to Wikipedia it was created in the Cognitive Science Laboratory of Princeton University starting in 1985. The project was initially funded by the US Office of Naval Research and later also by other US government agencies including DARPA, the National Science Foundation, the Disruptive Technology Office (formerly the Advanced Research and Development Activity), and REFLEX.
|
||||
|
||||
## Installation note
|
||||
add to /home/pi/.bashrc
|
||||
```
|
||||
if [ $(tty) == /dev/tty1 ]; then
|
||||
bash /home/pi/Documents/mundaneum/exhibition/growing_a_tree/growing_a_tree.sh
|
||||
fi
|
||||
```
|
||||
|
||||
# Authors
|
||||
An Mertens, Gijs de Heij
|
||||
|
||||
# License
|
||||
Copyright (C) Algolit, Brussels, 2019
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details: <http://www.gnu.org/licenses/>.
|
||||
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
Bernd Heinrich (born April 19, 1940 in Bad Polzin, Germany), is a professor emeritus in the biology department at the University of Vermont and is the author of a number of books about nature writing and biology. Heinrich has made major contributions to the study of insect physiology and behavior, as well as bird behavior. In addition to many scientific publications, Heinrich has written over a dozen highly praised books, mostly related to his research examining the physiological, ecological and behavioral adaptations of animals and plants to their physical environments. However, he has also written books that include more of his personal reflections on nature. He is the son of Ichneumon-expert Gerd Heinrich.
|
@ -0,0 +1 @@
|
||||
Clarissa Pinkola Estés (born January 27, 1945) is an American poet, Jungian psychoanalyst, post-trauma recovery specialist, author and spoken word artist.
|
@ -0,0 +1 @@
|
||||
Anthony Jay Robbins (born Anthony J. Mahavoric; February 29, 1960) is an American author, philanthropist and life coach. Robbins is known for his infomercials, seminars, and self-help books including Unlimited Power and Awaken the Giant Within.In 2015 and 2016 Robbins was listed on the Worth Magazine Power 100 list. His seminars are organized through Robbins Research International.
|
@ -0,0 +1 @@
|
||||
Jodi Thomas (born Amarillo, Texas) is the pen name of Jodi Koumalats, an American author of historical romance novels, most of which are set in Texas.
|
@ -0,0 +1 @@
|
||||
Richard Thomas Mabey (born 20 February 1941) is a writer and broadcaster, chiefly on the relations between nature and culture.
|
@ -0,0 +1,3 @@
|
||||
Timothy Fridtjof Flannery (born 28 January 1956) is an Australian mammalogist, palaeontologist, environmentalist, conservationist, explorer, and public scientist. Having discovered more than 30 mammal species (including new species of tree kangaroos), he served as the Chief Commissioner of the Climate Commission, a Federal Government body providing information on climate change to the Australian public. On 23 September 2013, Flannery announced that he would join other sacked commissioners to form the independent Climate Council, that would be funded by the community.
|
||||
Flannery is a professorial fellow at the Melbourne Sustainable Society Institute, University of Melbourne.
|
||||
Flannery was named Australian Humanist of the Year in 2005, and Australian of the Year in 2007. Until mid-2013 he was a professor at Macquarie University and held the Panasonic Chair in Environmental Sustainability. He was also chairman of the Copenhagen Climate Council, an international group of business and other leaders that coordinated a business response to climate change and assisted the Danish government in the lead up to COP 15. In 2015, the Jack P. Blaney Award for Dialogue recognized Tim Flannery for using dialogue and authentic engagement to build global consensus for action around climate change.His sometimes controversial views on shutting down conventional coal-fired power stations for electricity generation in the medium term are frequently cited in the media.
|
@ -0,0 +1 @@
|
||||
Vera Nazarian (born 1966 in Moscow, Soviet Union) is an Armenian-Russian (by ethnicity) American writer of fantasy, science fiction and other "wonder fiction" including Mythpunk, an artist, and the publisher of Norilana Books. She is a member of the Science Fiction and Fantasy Writers of America (SFWA) and the author of ten novels, including Dreams of the Compass Rose, a "collage" novel structured as a series of related and interlinked stories similar in arabesque flavor to The One Thousand and One Nights, Lords of Rainbow, a standalone epic fantasy about a world without color, the Cobweb Bride trilogy, and the Atlantis Grail books.
|
@ -0,0 +1,24 @@
|
||||
from trees import trees
|
||||
from growing_a_tree_sketch import bio
|
||||
import wikipedia
|
||||
import re
|
||||
import os.path
|
||||
import time
|
||||
|
||||
for gardener in trees.keys():
|
||||
print('Downloading bio for {}'.format(gardener))
|
||||
cut = " in "
|
||||
if cut in gardener:
|
||||
index = re.search(cut, gardener).start()
|
||||
gardener = gardener[:index]
|
||||
|
||||
try:
|
||||
bio = wikipedia.page(gardener).summary
|
||||
filename = re.sub(r'\W', '', gardener)
|
||||
|
||||
with open(os.path.join('bios', filename), 'w') as h:
|
||||
h.write(bio)
|
||||
except:
|
||||
pass
|
||||
|
||||
time.sleep(.5)
|
@ -0,0 +1,157 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: <utf-8> -*-
|
||||
|
||||
'''
|
||||
It automatises the Oulipo constraint Litterature Definitionelle:
|
||||
http://oulipo.net/fr/contraintes/litterature-definitionnelle
|
||||
|
||||
invented by Marcel Benabou in 1966
|
||||
In a given phrase, one replaces every significant element (noun, adjective, verb, adverb)
|
||||
by one of its definitions in a given dictionary ; one reiterates the operation on the newly received phrase,
|
||||
and again.
|
||||
|
||||
|
||||
Copyright (C) 2018 Constant, Algolit, An Mertens, Gijs de Heij
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details: <http://www.gnu.org/licenses/>.
|
||||
|
||||
'''
|
||||
|
||||
import nltk
|
||||
from nltk.corpus import wordnet as wn
|
||||
from nltk import word_tokenize
|
||||
import nltk.data
|
||||
import random
|
||||
import re
|
||||
import time
|
||||
import wikipedia
|
||||
from trees import trees
|
||||
import os
|
||||
import os.path
|
||||
|
||||
from colored import fg, attr
|
||||
|
||||
## Text attributes
|
||||
bold = attr(1)
|
||||
underlined = (4)
|
||||
reset = attr(0)
|
||||
|
||||
## Text colors
|
||||
black = fg(0)
|
||||
spring_green = fg(48)
|
||||
light_gray = fg(7)
|
||||
sky_blue = fg(109)
|
||||
yellow = fg(3)
|
||||
|
||||
|
||||
def choose_a_tree(dict):
|
||||
collection = random.choice(list(trees.items()))
|
||||
# Give name gardener
|
||||
gardening = collection[0]
|
||||
cut = " in "
|
||||
if cut in gardening:
|
||||
index = re.search(cut, gardening).start()
|
||||
gardener = gardening[:index]
|
||||
source = gardening[index+3:]
|
||||
else:
|
||||
gardener = gardening
|
||||
source = 'Unknown'
|
||||
# Trees (s)he planted
|
||||
tree = collection[1]
|
||||
# if (s)he planted more than 1 tree, pick 1
|
||||
if type(tree) == list:
|
||||
tree = random.choice(tree)
|
||||
return gardener, source, tree
|
||||
|
||||
# find bio gardener on Wikipedia
|
||||
def bio(gardener):
|
||||
try:
|
||||
bio = wikipedia.page(gardener)
|
||||
short_bio = bio.summary
|
||||
except:
|
||||
short_bio = "{}There is no English Wikipedia page about this person.{}".format(sky_blue, reset)
|
||||
return short_bio
|
||||
|
||||
def bio_offline(gardener):
|
||||
filename = os.path.join('bios', re.sub(r'\W', '', gardener))
|
||||
|
||||
if os.path.exists(filename):
|
||||
with open(filename, 'r') as h:
|
||||
return h.read()
|
||||
|
||||
return "{}There is no English Wikipedia page about this person.{}".format(sky_blue, reset)
|
||||
|
||||
|
||||
"""
|
||||
Return blossoming version of the knot.
|
||||
knot string
|
||||
return string
|
||||
"""
|
||||
def grow_new_branch (bud):
|
||||
branch = wn.synsets(bud)
|
||||
|
||||
if branch:
|
||||
return branch[0].definition()
|
||||
|
||||
return bud
|
||||
|
||||
# Turn nltk tree back into a sentence
|
||||
def trim_tree (branches):
|
||||
tree = " ".join([branch[0] for branch in branches])
|
||||
return re.sub(r'\s[\.,:;\(\)]', '', tree)
|
||||
|
||||
def show (state, length=1):
|
||||
os.system('clear')
|
||||
# Optionally vertically align here
|
||||
print(state)
|
||||
time.sleep(length)
|
||||
|
||||
def grow (tree, generation = 1):
|
||||
branches = nltk.pos_tag(word_tokenize(tree))
|
||||
# Filter out nouns, pick one
|
||||
position, bud = random.choice([(position, bud[0]) for position, bud in enumerate(branches) if bud[1] == 'NN'])
|
||||
|
||||
# Make new tree placeholder for the bud show we can show it in two states and then grow out
|
||||
next_tree = '{} {{}} {}'.format(trim_tree(branches[:max(0, position)]), trim_tree(branches[position+1:]))
|
||||
new_branch = grow_new_branch(bud)
|
||||
|
||||
show(tree, 3 if generation == 1 else 1)
|
||||
# Mark the bud, underlined and orange
|
||||
show(next_tree.format("{}{}{}{}{}".format(bold, yellow, bud, reset, black)), 2)
|
||||
# Mark the new branch green
|
||||
show(next_tree.format("{}{}{}".format(spring_green, new_branch, black)), 2)
|
||||
show(next_tree.format("{}{}{}".format(fg(82), new_branch, black)), 1)
|
||||
show(next_tree.format("{}{}{}".format(fg(120), new_branch, black)), 1)
|
||||
show(next_tree.format("{}{}{}".format(fg(157), new_branch, black)), 1)
|
||||
show(next_tree.format("{}{}{}".format(fg(195), new_branch, black)), 1)
|
||||
# Let it grow again
|
||||
|
||||
return next_tree.format(new_branch)
|
||||
|
||||
if __name__ == '__main__':
|
||||
while True:
|
||||
gardener, source, tree = choose_a_tree(trees)
|
||||
short_bio = bio_offline(gardener)
|
||||
|
||||
show(
|
||||
'Using a quote by {}{}{}\n\n'.format(bold, gardener, reset) \
|
||||
+ short_bio, 3
|
||||
)
|
||||
|
||||
generation = 1
|
||||
|
||||
while len(tree) < 1500:
|
||||
next_tree = grow(tree, generation)
|
||||
if next_tree == tree:
|
||||
break
|
||||
else:
|
||||
tree = next_tree
|
||||
generation += 1
|
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env/ python
|
||||
|
||||
trees = {
|
||||
"Hermann Hesse in Baume. Betrachtungen und Gedichte": ["For me, trees have always been the most penetrating preachers.", "Nothing is holier, nothing is more exemplary than a beautiful, strong tree.", "When a tree is cut down and reveals its naked death-wound to the sun, one can read its whole history in the luminous, inscribed disk of its trunk: in the rings of its years, its scars, all the struggle, all the suffering, all the sickness, all the happiness and prosperity stand truly written, the narrow years and the luxurious years, the attacks withstood, the storms endured.", "And every young farmboy knows that the hardest and noblest wood has the narrowest rings, that high on the mountains and in continuing danger the most indestructible, the strongest, the ideal trees grow.", "Trees are sanctuaries. Whoever knows how to speak to them, whoever knows how to listen to them, can learn the truth. They do not preach learning and precepts, they preach, undeterred by particulars, the ancient law of life.", "A tree says: A kernel is hidden in me, a spark, a thought, I am life from eternal life. The attempt and the risk that the eternal mother took with me is unique, unique the form and veins of my skin, unique the smallest play of leaves in my branches and the smallest scar on my bark. I was made to form and reveal the eternal in my smallest special detail.", "A tree says: My strength is trust. I know nothing about my fathers, I know nothing about the thousand children that every year spring out of me. I live out the secret of my seed to the very end, and I care for nothing else. I trust that God is in me. I trust that my labor is holy. Out of this trust I live.", "So the tree rustles in the evening, when we stand uneasy before our own childish thoughts: Trees have long thoughts, long-breathing and restful, just as they have longer lives than ours. They are wiser than we are, as long as we do not listen to them. But when we have learned how to listen to trees, then the brevity and the quickness and the childlike hastiness of our thoughts achieve an incomparable joy. Whoever has learned how to listen to trees no longer wants to be a tree. He wants to be nothing except what he is. That is home. That is happiness."],\
|
||||
"Maya Angelou": ["When great trees fall, rocks on distant hills shudder, lions hunker down in tall grasses, and even elephants lumber after safety.", "When great trees fall in forests, small things recoil into silence, their senses eroded beyond fear."],\
|
||||
"Chris Maser in Forest Primeval: The Natural History of an Ancient Forest": "What we are doing to the forests of the world is but a mirror reflection of what we are doing to ourselves and to one another.", \
|
||||
"Ralph Waldo Emerson": "The creation of a thousand forests is in one acorn.",\
|
||||
"William Blake": "The tree which moves some to tears of joy is in the eyes of others only a green thing that stands in the way. Some see nature all ridicule and deformity... and some scarce see nature at all. But to the eyes of the man of imagination, nature is imagination itself.",\
|
||||
"John Lubbock in The Use Of Life": "Rest is not idleness, and to lie sometimes on the grass under trees on a summer's day, listening to the murmur of the water, or watching the clouds float across the sky, is by no means a waste of time.",\
|
||||
"Franklin D. Roosevelt": "A nation that destroys its soils destroys itself. Forests are the lungs of our land, purifying the air and giving fresh strength to our people.",\
|
||||
"Kahlil Gibran in Sand and Foam": "Trees are poems that the earth writes upon the sky.",\
|
||||
"Clarissa Pinkola Estes in The Faithful Gardener: A Wise Tale About That Which Can Never Die": "To be poor and be without trees, is to be the most starved human being in the world. To be poor and have trees, is to be completely rich in ways that money can never buy.",\
|
||||
"Dorothy Parker in Not So Deep As A Well: Collected Poems": "I never see that prettiest thing, a cherry bough gone white with Spring. But what I think, how gay it would be to hang me from a flowering tree.",\
|
||||
"Jodi Thomas in Welcome to Harmony": "When trees burn, they leave the smell of heartbreak in the air.",\
|
||||
"Santosh Kalwar": "All our wisdom is stored in the trees.",\
|
||||
"Thomas Hardy in Under the Greenwood Tree": "To dwellers in a wood, almost every species of tree has its voice as well as its feature.",\
|
||||
"Vera Nazarian in The Perpetual Calendar of Inspiration": "Listen to the trees as they sway in the wind. Their leaves are telling secrets. Their bark sings songs of olden days as it grows around the trunks. And their roots give names to all things. Their language has been lost. But not the gestures.",\
|
||||
"Andrea Koehle Jones in The Wish Trees": "I'm planting a tree to teach me to gather strength from my deepest roots.",\
|
||||
"Marcel Proust": "We have nothing to fear and a great deal to learn from trees, that vigorours and pacific tribe which without stint produces strengthening essences for us, soothing balms, and in whose gracious company we spend so many cool, silent, and intimate hours.",\
|
||||
"Bernd Heinrich in The Trees in My Forest": "The very idea of managing a forest in the first place is oxymoronic, because a forest is an ecosystem that is by definition self-managing.",\
|
||||
"Mokokoma Mokhonoana": "Plants are more courageous than almost all human beings: an orange tree would rather die than produce lemons, whereas instead of dying the average person would rather be someone they are not.",\
|
||||
"George Orwell": "The planting of a tree, especially one of the long-living hardwood trees, is a gift which you can make to posterity at almost no cost and with almost no trouble, and if the tree takes root it will far outlive the visible effect of any of your other actions, good or evil.",\
|
||||
"Richard Mabey in Beechcombings: The narratives of trees": "To be without trees would, in the most literal way, to be without our roots.",\
|
||||
"Seneca": "When you enter a grove peopled with ancient trees, higher than the ordinary, and shutting out the sky with their thickly inter-twined branches, do not the stately shadows of the wood, the stillness of the place, and the awful gloom of this doomed cavern then strike you with the presence of a deity?",\
|
||||
"Tim Flannery in Peter Wohllebens The Hidden Life of Trees": "A tree's most important means of staying connected to other trees is a wood wide web of soil fungi that connects vegetation in an intimate network that allows the sharing of an enormous amount of information and goods.",\
|
||||
"Terry Pratchett in Good Omens: The Nice and Accurate Prophecies of Agnes Nutter, Witch": "Jaime had never realised that trees made a sound when they grew, and no-one else had realised it either, because the sound is made over hundreds of years in waves of twenty-four hours from peak to peak. Speed it up, and the sound a tree makes is vrooom.",\
|
||||
"Kamand Kojouri": "Think the tree that bears nutrition: though the fruits are picked, the plant maintains fruition. So give all the love you have. Do not hold any in reserve. What is given is not lost; it shall return.",\
|
||||
"Jim Robbins in The Man Who Planted Trees: Lost Groves, Champion Trees, and an Urgent Plan to Save the Planet": ["Planting trees may be the single most important ecotechnology that we have to put the broken pieces of our planet back together.", "What an irony it is that these living beings whose shade we sit in, whose fruit we eat, whose limbs we climb, whose roots we water, to whom most of us rarely give a second thought, are so poorly understood. We need to come, as soon as possible, to a profound understanding and appreciation for trees and forests and the vital role they play, for they are among our best allies in the uncertain future that is unfolding."],\
|
||||
"Laura Lafargue in Correspondence Volume 2 1887-1890": "I wish the trees would go into leaf that I might find out what they are. In their present undress I cannot recognise them. It's true that I doubt if I should know my best friends--men or women--with their clothes off.",\
|
||||
"Scott Blum in Waiting for Autumn": "I'm such a fan of nature, and being with the trees every day fills me with joy.",\
|
||||
"Mehmet Murat ildan": ["Why pay money for the horror movies? Just go to a street without trees!", "When you save the life of a tree, you only pay your debt as we all owe our lives to the trees!"],\
|
||||
}
|
Loading…
Reference in New Issue