Copied code installation Mundaneum, English version

master
ana mertens 4 years ago
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,3 @@
Dorothy Parker (née Rothschild; August 22, 1893 June 7, 1967) was an American poet, writer, critic, and satirist based in New York; she was best known for her wit, wisecracks, and eye for 20th-century urban foibles.
From a conflicted and unhappy childhood, Parker rose to acclaim, both for her literary works published in such magazines as The New Yorker and as a founding member of the Algonquin Round Table. Following the breakup of the circle, Parker traveled to Hollywood to pursue screenwriting. Her successes there, including two Academy Award nominations, were curtailed when her involvement in left-wing politics resulted in her being placed on the Hollywood blacklist.
Dismissive of her own talents, she deplored her reputation as a "wisecracker". Nevertheless, both her literary output and reputation for sharp wit have endured.

@ -0,0 +1,4 @@
Franklin Delano Roosevelt (, ; January 30, 1882 April 12, 1945), often referred to by his initials FDR, was an American statesman and political leader who served as the 32nd president of the United States from 1933 until his death in 1945. A Democrat, he won a record four presidential elections and became a central figure in world events during the first half of the 20th century. Roosevelt directed the federal government during most of the Great Depression, implementing his New Deal domestic agenda in response to the worst economic crisis in U.S. history. As a dominant leader of his party, he built the New Deal Coalition, which realigned American politics into the Fifth Party System and defined American liberalism throughout the middle third of the 20th century. His third and fourth terms were dominated by World War II. Roosevelt is widely considered to be one of the most important figures in American history, as well as among the most influential figures of the 20th century. Though he has also been subject to much criticism, he is generally rated by scholars as one of the three greatest U.S. presidents, along with George Washington and Abraham Lincoln.
Roosevelt was born in Hyde Park, New York, to a Dutch American family made well known by Theodore Roosevelt, the 26th president of the United States and William Henry Aspinwall. FDR attended Groton School, Harvard College, and Columbia Law School, and went on to practice law in New York City. In 1905, he married his fifth cousin once removed, Eleanor Roosevelt. They had six children. He won election to the New York State Senate in 1910, and then served as Assistant Secretary of the Navy under President Woodrow Wilson during World War I. Roosevelt was James M. Cox's running mate on the Democratic Party's 1920 national ticket, but Cox was defeated by Warren G. Harding. In 1921, Roosevelt contracted a paralytic illness, believed at the time to be polio, and his legs became permanently paralyzed. While attempting to recover from his condition, Roosevelt founded the treatment center in Warm Springs, Georgia, for people with poliomyelitis. In spite of being unable to walk unaided, Roosevelt returned to public office by winning election as Governor of New York in 1928. He was in office from 1929 to 1933 and served as a reform Governor, promoting programs to combat the economic crisis besetting the United States at the time.
In the 1932 presidential election, Roosevelt defeated Republican President Herbert Hoover in a landslide. Roosevelt took office while the United States was in the midst of the Great Depression, the worst economic crisis in the country's history. During the first 100 days of the 73rd United States Congress, Roosevelt spearheaded unprecedented federal legislation and issued a profusion of executive orders that instituted the New Deal—a variety of programs designed to produce relief, recovery, and reform. He created numerous programs to provide relief to the unemployed and farmers while seeking economic recovery with the National Recovery Administration and other programs. He also instituted major regulatory reforms related to finance, communications, and labor, and presided over the end of Prohibition. He harnessed radio to speak directly to the American people, giving 30 "fireside chat" radio addresses during his presidency and becoming the first American president to be televised. The economy having improved rapidly from 1933 to 1936, Roosevelt won a landslide reelection in 1936. However, the economy then relapsed into a deep recession in 1937 and 1938. After the 1936 election, Roosevelt sought passage of the Judiciary Reorganization Bill of 1937 (the "court packing plan"), which would have expanded the size of the Supreme Court of the United States. The bipartisan Conservative Coalition that formed in 1937 prevented passage of the bill and blocked the implementation of further New Deal programs and reforms. Major surviving programs and legislation implemented under Roosevelt include the Securities and Exchange Commission, the National Labor Relations Act, the Federal Deposit Insurance Corporation, and Social Security.
Roosevelt ran successfully for reelection in 1940. His victory made him the only U.S. President to serve for more than two terms. With World War II looming after 1938, Roosevelt gave strong diplomatic and financial support to China as well as the United Kingdom and the Soviet Union while the U.S. remained officially neutral. Following the Japanese attack on Pearl Harbor on December 7, 1941, an event he famously called "a date which will live in infamy", Roosevelt obtained a declaration of war on Japan the next day, and a few days later, on Germany and Italy. Assisted by his top aide Harry Hopkins and with very strong national support, he worked closely with British Prime Minister Winston Churchill, Soviet leader Joseph Stalin and Chinese Generalissimo Chiang Kai-shek in leading the Allies against the Axis Powers. Roosevelt supervised the mobilization of the U.S. economy to support the war effort and implemented a Europe first strategy, making the defeat of Germany a priority over that of Japan. He also initiated the development of the world's first atomic bomb and worked with the other Allied leaders to lay the groundwork for the United Nations and other post-war institutions. Roosevelt won reelection in 1944 but with his physical health declining during the war years, he died in April 1945, just 11 weeks into his fourth term. The Axis Powers surrendered to the Allies in the months following Roosevelt's death, during the presidency of Roosevelt's successor, Harry S. Truman.

@ -0,0 +1 @@
Eric Arthur Blair (25 June 1903 21 January 1950), better known by his pen name George Orwell, was an English novelist, essayist, journalist and critic, whose work is marked by lucid prose, awareness of social injustice, opposition to totalitarianism, and outspoken support of democratic socialism.Orwell wrote literary criticism, poetry, fiction and polemical journalism. He is best known for the allegorical novella Animal Farm (1945) and the dystopian novel Nineteen Eighty-Four (1949). His non-fiction works, including The Road to Wigan Pier (1937), documenting his experience of working class life in the north of England, and Homage to Catalonia (1938), an account of his experiences on the Republican side in the Spanish Civil War, are widely acclaimed, as are his essays on politics, literature, language and culture. In 2008, The Times ranked him second on a list of "The 50 greatest British writers since 1945".Orwell's work continues to influence popular and political culture and the term "Orwellian"—descriptive of totalitarian or authoritarian social practices—has entered the language together with many of his neologisms, including "Big Brother", "Thought Police", "Room 101", "memory hole", "newspeak", "doublethink", "proles", "unperson" and "thoughtcrime".

@ -0,0 +1 @@
Hermann Karl Hesse (German: [ˈhɛɐ̯man ˈhɛsə]; 2 July 1877 9 August 1962) was a German-born poet, novelist, and painter. His best-known works include Demian, Steppenwolf, Siddhartha, and The Glass Bead Game, each of which explores an individual's search for authenticity, self-knowledge and spirituality. In 1946, he received the Nobel Prize in Literature.

@ -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,2 @@
Khalil Gibran (); sometimes spelled Kahlil; (full Arabic name Gibran Khalil Gibran) (Arabic: جبران خليل جبران‎ / ALA-LC: Jubrān Khalīl Jubrān or Jibrān Khalīl Jibrān) (January 6, 1883 April 10, 1931) was a Lebanese-American writer, poet, visual artist and Lebanese nationalist.
Gibran was born in the town of Bsharri in the Mount Lebanon Mutasarrifate, Ottoman Empire (modern-day Lebanon), to Khalil Gibran and Kamila Gibran (Rahmeh). As a pre-teen Gibran emigrated with his family to the United States, where he studied art and began his literary career, writing in both English and Arabic. In the Arab world, Gibran is regarded as a literary and political rebel. His romantic style was at the heart of a renaissance in modern Arabic literature, especially prose poetry, breaking away from the classical school. In Lebanon, he is still celebrated as a literary hero.A member of the New York Pen League, he is chiefly known in the English-speaking world for his 1923 book The Prophet, an early example of inspirational fiction including a series of philosophical essays written in poetic English prose. The book sold well despite a cool critical reception, gaining popularity in the 1930s and again especially in the 1960s counterculture.Gibran is the third-best-selling poet of all time, behind Shakespeare and Laozi.

@ -0,0 +1 @@
Jenny Laura Marx (26 September 1845 25 November 1911), better known as Laura Marx, was the second daughter of Karl Marx and Jenny von Westphalen. In 1868, she married Paul Lafargue. The two committed suicide together in 1911.

@ -0,0 +1 @@
Valentin Louis Georges Eugène Marcel Proust (; French: [maʁsɛl pʁust]; 10 July 1871 18 November 1922), known as Marcel Proust, was a French novelist, critic, and essayist best known for his monumental novel À la recherche du temps perdu (In Search of Lost Time; earlier rendered as Remembrance of Things Past), published in seven parts between 1913 and 1927. He is considered by critics and writers to be one of the most influential authors of the 20th century.

@ -0,0 +1,3 @@
Maya Angelou ( (listen); born Marguerite Annie Johnson; April 4, 1928 May 28, 2014) was an American poet, singer, memoirist, and civil rights activist. She published seven autobiographies, three books of essays, several books of poetry, and is credited with a list of plays, movies, and television shows spanning over 50 years. She received dozens of awards and more than 50 honorary degrees. Angelou is best known for her series of seven autobiographies, which focus on her childhood and early adult experiences. The first, I Know Why the Caged Bird Sings (1969), tells of her life up to the age of 17 and brought her international recognition and acclaim.
She became a poet and writer after a series of occupations as a young adult, including fry cook, sex worker, nightclub dancer and performer, cast member of the opera Porgy and Bess, coordinator for the Southern Christian Leadership Conference, and journalist in Egypt and Ghana during the decolonization of Africa. She was an actress, writer, director, and producer of plays, movies, and public television programs. In 1982, she was named the first Reynolds Professor of American Studies at Wake Forest University in Winston-Salem, North Carolina. She was active in the Civil Rights Movement and worked with Martin Luther King Jr. and Malcolm X. Beginning in the 1990s, she made around 80 appearances a year on the lecture circuit, something she continued into her eighties. In 1993, Angelou recited her poem "On the Pulse of Morning" (1993) at the first inauguration of Bill Clinton, making her the first poet to make an inaugural recitation since Robert Frost at the inauguration of John F. Kennedy in 1961.
With the publication of I Know Why the Caged Bird Sings, Angelou publicly discussed aspects of her personal life. She was respected as a spokesperson for black people and women, and her works have been considered a defense of black culture. Her works are widely used in schools and universities worldwide, although attempts have been made to ban her books from some U.S. libraries. Angelou's most celebrated works have been labeled as autobiographical fiction, but many critics consider them to be autobiographies. She made a deliberate attempt to challenge the common structure of the autobiography by critiquing, changing and expanding the genre. Her books center on themes such as racism, identity, family and travel.

@ -0,0 +1,2 @@
Ralph Waldo Emerson (May 25, 1803 April 27, 1882) was an American essayist, lecturer, philosopher, and poet who led the transcendentalist movement of the mid-19th century. He was seen as a champion of individualism and a prescient critic of the countervailing pressures of society, and he disseminated his thoughts through dozens of published essays and more than 1,500 public lectures across the United States.
Emerson gradually moved away from the religious and social beliefs of his contemporaries, formulating and expressing the philosophy of transcendentalism in his 1836 essay "Nature". Following this work, he gave a speech entitled "The American Scholar" in 1837, which Oliver Wendell Holmes Sr. considered to be America's "intellectual Declaration of Independence."Emerson wrote most of his important essays as lectures first and then revised them for print. His first two collections of essays, Essays: First Series (1841) and Essays: Second Series (1844), represent the core of his thinking. They include the well-known essays "Self-Reliance", "The Over-Soul", "Circles", "The Poet", and "Experience." Together with "Nature", these essays made the decade from the mid-1830s to the mid-1840s Emerson's most fertile period. Emerson wrote on a number of subjects, never espousing fixed philosophical tenets, but developing certain ideas such as individuality, freedom, the ability for mankind to realize almost anything, and the relationship between the soul and the surrounding world. Emerson's "nature" was more philosophical than naturalistic: "Philosophically considered, the universe is composed of Nature and the Soul." Emerson is one of several figures who "took a more pantheist or pandeist approach by rejecting views of God as separate from the world."He remains among the linchpins of the American romantic movement, and his work has greatly influenced the thinkers, writers and poets that followed him. "In all my lectures," he wrote, "I have taught one doctrine, namely, the infinitude of the private man." Emerson is also well known as a mentor and friend of Henry David Thoreau, a fellow transcendentalist.

@ -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 @@
Sir Terence David John Pratchett (28 April 1948 12 March 2015) was an English author of fantasy novels, especially comical works. He is best known for his Discworld series of 41 novels.
Pratchett's first novel, The Carpet People, was published in 1971. The first Discworld novel, The Colour of Magic, was published in 1983, after which Pratchett wrote an average of two books a year. His 2011 Discworld novel Snuff became the third-fastest-selling hardback adult-readership novel since records began in the UK, selling 55,000 copies in the first three days. The final Discworld novel, The Shepherd's Crown, was published in August 2015, five months after his death.
Pratchett, with more than 85 million books sold worldwide in 37 languages, was the UK's best-selling author of the 1990s. He was appointed Officer of the Order of the British Empire (OBE) in 1998 and was knighted for services to literature in the 2009 New Year Honours. In 2001 he won the annual Carnegie Medal for The Amazing Maurice and his Educated Rodents, the first Discworld book marketed for children. He received the World Fantasy Award for Life Achievement in 2010.In December 2007, Pratchett announced that he had been diagnosed with early-onset Alzheimer's disease. He later made a substantial public donation to the Alzheimer's Research Trust (now Alzheimer's Research UK), filmed a television programme chronicling his experiences with the condition for the BBC, and also became a patron for Alzheimer's Research UK. Pratchett died on 12 March 2015 aged 66.

@ -0,0 +1,3 @@
Thomas Hardy (2 June 1840 11 January 1928) was an English novelist and poet. A Victorian realist in the tradition of George Eliot, he was influenced both in his novels and in his poetry by Romanticism, especially William Wordsworth. He was highly critical of much in Victorian society, especially on the declining status of rural people in Britain, such as those from his native South West England.
While Hardy wrote poetry throughout his life and regarded himself primarily as a poet, his first collection was not published until 1898. Initially, therefore, he gained fame as the author of such novels as Far from the Madding Crowd (1874), The Mayor of Casterbridge (1886), Tess of the d'Urbervilles (1891), and Jude the Obscure (1895). During his lifetime, Hardy's poetry was acclaimed by younger poets (particularly the Georgians) who viewed him as a mentor. After his death his poems were lauded by Ezra Pound, W. H. Auden and Philip Larkin.Many of his novels concern tragic characters struggling against their passions and social circumstances, and they are often set in the semi-fictional region of Wessex; initially based on the medieval Anglo-Saxon kingdom, Hardy's Wessex eventually came to include the counties of Dorset, Wiltshire, Somerset, Devon, Hampshire and much of Berkshire, in southwest and south central England. Two of his novels, Tess of the d'Urbervilles and Far from the Madding Crowd, were listed in the top 50 on the BBC's survey The Big Read.

@ -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 @@
William Blake (28 November 1757 12 August 1827) was an English poet, painter, and printmaker. Largely unrecognised during his lifetime, Blake is now considered a seminal figure in the history of the poetry and visual arts of the Romantic Age. What he called his prophetic works were said by 20th-century critic Northrop Frye to form "what is in proportion to its merits the least read body of poetry in the English language". His visual artistry led 21st-century critic Jonathan Jones to proclaim him "far and away the greatest artist Britain has ever produced". In 2002, Blake was placed at number 38 in the BBC's poll of the 100 Greatest Britons. While he lived in London his entire life, except for three years spent in Felpham, he produced a diverse and symbolically rich œuvre, which embraced the imagination as "the body of God" or "human existence itself".Although Blake was considered mad by contemporaries for his idiosyncratic views, he is held in high regard by later critics for his expressiveness and creativity, and for the philosophical and mystical undercurrents within his work. His paintings and poetry have been characterised as part of the Romantic movement and as "Pre-Romantic". A committed Christian who was hostile to the Church of England (indeed, to almost all forms of organised religion), Blake was influenced by the ideals and ambitions of the French and American Revolutions. Though later he rejected many of these political beliefs, he maintained an amiable relationship with the political activist Thomas Paine; he was also influenced by thinkers such as Emanuel Swedenborg. Despite these known influences, the singularity of Blake's work makes him difficult to classify. The 19th-century scholar William Rossetti characterised him as a "glorious luminary", and "a man not forestalled by predecessors, nor to be classed with contemporaries, nor to be replaced by known or readily surmisable successors".

@ -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…
Cancel
Save