Merge branch 'master' of git.xpub.nl:/var/www/git.xpub.nl/repos/OuNuPo-make

master
ange 7 years ago
commit 2b340505c6

1
.gitignore vendored

@ -4,3 +4,4 @@ src/index.json
src/database.json
.DS_Store
src/**.wav
ocr/list.txt

@ -41,11 +41,6 @@ dirs: ## create the dirs in working dir
@echo $(color_r)'Directories made': ocr/ hocr/ images/ images-tiff/ output/
testif:
ifeq ($(OS),Darwin)
@echo $(OS)
endif
# POST-PROCESSING RECIPES
ocr/output.txt: ## ocr with tesseract
@ -112,18 +107,6 @@ replace:tiffs hocrs ## Natasha: Analyzes pages in order, replace least common wo
rm $(input-hocr)
rm $(images-tiff)
visualization: $(images) $(tmpfile) ##Creates data visualization from images/*.jpg. Dependencies: mplayer
@echo $(tmpfile)
for i in $(images); do \
cat $$i >> $(tmpfile); \
done;
ifeq ($(OS),Darwin)
cat $(tmpfile) | mplayer -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=56:h=64:i420:fps=25 -;
else
cat $(tmpfile) | mplayer -vo x11 -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=50:h=50:i420:fps=25 -;
endif
ttssr-human-only: ocr/output.txt ## Loop: text to speech-speech recognition. Dependencies: espeak, pocketsphinx
bash src/ttssr-loop-human-only.sh ocr/output.txt

140
README

@ -1,12 +1,11 @@
# OuNuPo Make
Software experiments for the OuNuPo bookscanner, part of Special Issue 5
https://issue.xpub.nl/05/
<https://issue.xpub.nl/05/>
https://xpub.nl/
<https://git.xpub.nl/OuNuPo-make/>
## Licenses
<https://xpub.nl/>
## Authors
@ -25,61 +24,55 @@ Natasha Berting, Angeliki Diakrousi, Joca van der Horst, Alexander Roidl, Alice
# Make commands
## N+7 (example) Author
Description: Replaces every noun with the 7th next noun in a dictionary. Inspired by an Oulipo work of the same name.
run: `make N+7`
Specific Dependencies:
* a
* b
* c
## Sitting inside a pocket(sphinx): Angeliki
Description: Speech recognition feedback loops using the first sentence of a scanned text as input
Speech recognition feedback loops using the first sentence of a scanned text as input
run: `make ttssr-human-only`
Specific Dependencies:
Specific Dependencies:
* PocketSphinx package `sudo aptitude install pocketsphinx pocketsphinx-en-us`
* PocketSphinx: `sudo pip3 install PocketSphinx`
* Python Libaries:`sudo apt-get install gcc automake autoconf libtool bison swig python-dev libpulse-dev`
* Speech Recognition: `sudo pip3 install SpeechRecognition`
* TermColor: `sudo pip3 install termcolor`
* PyAudio: `pip3 install pyaudio`
* PocketSphinx Python library: `sudo pip3 install PocketSphinx`
* Other software packages:`sudo apt-get install gcc automake autoconf libtool bison swig python-dev libpulse-dev`
* Speech Recognition Python library: `sudo pip3 install SpeechRecognition`
* TermColor Python library: `sudo pip3 install termcolor`
* PyAudio Python library: `sudo pip3 install pyaudio`
Licenses:
### Licenses:
© 2018 WTFPL Do What the Fuck You Want to Public License.
© 2018 BSD 3-Clause Berkeley Software Distribution
## Reading the Structure: Joca
Description: Uses OCR'ed text as an input, labels each word for Part-of-Speech, stopwords and sentiment. Then it generates a reading interface
Uses OCR'ed text as an input, labels each word for Part-of-Speech, stopwords and sentiment. Then it generates a reading interface
where words with a specific label are hidden. Output can be saved as poster, or exported as json featuring the full data set.
Run: `make reading_structure`
Specific Dependencies:
* nltk (http://www.nltk.org/install.html)
* tokenize.punkt, pos_tag, word_tokenize, sentiment.vader, vader_lexicon (python3, import NLTK, nltk.download() and select these models)
* spaCy (https://spacy.io/usage/)
* spacy en_core_web_sm model (python3 -m spacy download en_core_web_sm)
* weasyprint (http://weasyprint.readthedocs.io/en/latest/install.html)
* jinja2 (http://jinja.pocoo.org/docs/2.10/intro/#installation)
* font: PT Sans (os font https://www.fontsquirrel.com/fonts/pt-serif)
* font: Ubuntu Mono (os font https://www.fontsquirrel.com/fonts/ubuntu-mono)
License: GNU AGPLv3
* [NLTK](http://www.nltk.org/install.html) packages: tokenize.punkt, pos_tag, word_tokenize, sentiment.vader, vader_lexicon (python3; import nltk; nltk.download() and select these models)
* [spaCy](https://spacy.io/usage/) Python library
* spacy: en_core_web_sm model (python3 -m spacy download en_core_web_sm)
* [weasyprint](http://weasyprint.readthedocs.io/en/latest/install.html)
* [jinja2](http://jinja.pocoo.org/docs/2.10/intro/#installation)
* font: [PT Sans]( https://www.fontsquirrel.com/fonts/pt-serif)
* font: [Ubuntu Mono](https://www.fontsquirrel.com/fonts/ubuntu-mono)
### License: GNU AGPLv3
Permissions of this license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license.
Copyright and license notices must be preserved. Contributors provide an express grant of patent rights.
When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.
See src/reading_structure/license.txt for the full license.
## Erase / Replace: Natasha
Description: Receives your scanned pages in order, then analyzes each image and its vocabulary. Finds and crops the least common words, and either erases them, or replaces them with the most common words. Outputs a PDF of increasingly distorted scan images.
for erase script run: `make erase`
for replace script run: `make replace`
For erase script run: `make erase`
For replace script run: `make replace`
Specific Dependencies:
* NLTK English Corpus:
@ -89,62 +82,73 @@ Specific Dependencies:
* "Download"
* Python Image Library (PIL): `pip3 install Pillow`
* PDF generation for Python (FPDF): `pip3 install fpdf`
* HTML5lib: `pip3 install html5lib`
* HTML5lib Python Library: `pip3 install html5lib`
Notes & Bugs:
### Notes & Bugs:
This script is very picky about the input images it can work with. For best results, please use high resolution images in RGB colorspace. Errors can occur when image modes do not match or tesseract cannot successfully make HOCR files.
Author: Alice Strete (RO)
## carlandre & over/under: Alice Strete
Person who aspires to call herself a software artist sometime next year.
License:
### License:
Copyright © 2018 Alice Strete
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
Programs:
## carlandre
### Dependencies:
* [pytest](https://docs.pytest.org/en/latest/getting-started.html)
Programs:
### carlandre
Description: Generates concrete poetry from a text file. If you're connected to a printer located in /dev/usb/lp0 you can print the poem.
run: make carlandre
run: `make carlandre`
Dependencies:
* pytest (Documentation: https://docs.pytest.org/en/latest/getting-started.html)
## over/under
### over/under
Description: Interpreted programming language written in Python3 which translates basic weaving instructions into code and applies them to text.
run: make overunder
run: `make overunder`
Instructions:
over/under works with specific commands which execute specific instructions.
When running, an interpreter will open:
>
To load your text, type 'load'. This is necessary before any other instructions. Every time you load the text, the previous instructions will be discarded.
To see the line you are currently on, type 'show'.
To start your pattern, type 'over' or 'under', each followed by an integer, separated by a comma.
### Instructions:
* over/under works with specific commands which execute specific instructions.
* When running, an interpreter will open:
`> `
* To load your text, type 'load'. This is necessary before any other instructions. Every time you load the text, the previous instructions will be discarded.
* To see the line you are currently on, type 'show'.
* To start your pattern, type 'over' or 'under', each followed by an integer, separated by a comma.
e.g. over 5, under 5, over 6, under 10
To move on to the next line of text, press enter twice.
To see your pattern, type 'pattern'.
To save your pattern in a text file, type 'save'.
To leave the program, type 'quit'.
* To move on to the next line of text, press enter twice.
* To see your pattern, type 'pattern'.
* To save your pattern in a text file, type 'save'.
* To leave the program, type 'quit'.
## oulibot: Alex
Description: Chatbot that will help you to write a poem based on the text you inserted by giving you constraints.
run: make oulibot
run: `make oulibot`
#### Dependencies:
Python libraries
* irc : `pip3 install irc`
* rake_nltk Python library: `pip3 install rake_nltk`
* textblob: `pip3 install textblob`
* PIL: `pip3 install Pillow`
* numpy: `pip3 install numpy`
* tweepy: `pip3 install tweepy`
* NLTK stopwords:
* run NLTK downloader `python -m nltk.downloader`
* select menu "Corpora"
* select "stopwords"
* "Download"
Dependencies:
irc.bot: pip3 install irc_client
nltk: pip3 install nltk && python3 -m nltk.downloader
rake_nltk: pip3 install rake_nltk
nltk.tokenize
nltk.corpus
textblob: pip3 install textblob
PIL: pip3 install Pillow
numpy: pip3 install numpy
tweepy: pip3 install tweepy

@ -1,3 +1,4 @@
images/0029.jpg

@ -0,0 +1,10 @@
The computer emerges out of the history of weaving the process so often said to be the quintessence of women's work. The loom is the vanguard site of software development. Indeed it is from the loom or rather the process of weaving that this paper takes another cue. Perhaps it is an instance of this process as well for tales and texts are woven as surely as threads and fabrics. This paper is a yarn in both senses. It is about weaving women and cybernetics and is also weaving women and cybernetics together. It concerns the looms of the past and also the future which looms over the patriarchal present and threatens the end of human history.
Ada Lovelace may have been the first encounter between woman and computer but the association between women and software throws back into the mythical origins of history. For Freud weaving imitates the concealment of the womb: the Greek hystera; the Latin matrix. Weaving is woman's compensation for the absence of the penis the void the woman of whom as he famously insists there is nothing to be seen Woman is veiled as Ada was in the passage above she weaves as Irigaray comments to sustain the disavowal of her sex Yet the development of the computer and the cybernetic machine as which it operates might even be described in terms of the introduction of increasing speed miniaturization and complexity to the process of weaving. These are the tendencies which converge in the global webs of data and the nets of communication by which cyberspace or the matrix are understood
Today both woman and the computer screen the matrix which also makes its appearance as the veils and screens on which its operations are displayed This is the virtual reality which is also the absence of the penis and its power but already more than the void The matrix emerges as the processes of an abstract weaving which produces or fabricates what man knows as nature his materials the fabrics the screens on which he projects his own identity
Weaving has always been a vanguard of machinic development perhaps because even in its most basic form the process is one of complexity always involving the weaving together of several threads into an integrated cloth. Even the drawloom which is often dated back to the China of 1000 BC involves sophisticated orderings of warp and weft if it is to produce the complex designs common in the silks of this period. This means that 'information is needed in large amounts for the weaving of a complex ornamental pattern. Even the most ancient Chinese examples required that about 1500 different warp threads be lifted in various combinations as the weaving proceeded' (Morrison and Morrison 1961: xxxiv). With pedals and shuttles the loom becomes what one historian refers to as the most complex human engine of them all a machine which reduced everything to simple actions the alternate movement of the feet worked the pedals raising half the threads of the warp and then the other while the hands threw the shuttle carrying the thread of the woof The weaver was integrated into the machinery bound up with its operations linked limb by limb to the processes. In the Middle Ages and before the artificial memories of the printed page squared paper charts were used to store the information necessary to the accurate development of the design. In early 18th-century Lyons Basyle Bouchon developed a mechanism for the automatic selection of threads using an early example of the punched paper rolls which were much later to allow pianos to play and type to be cast. This design was developed by Falcon a couple of years later who introduced greater complexity with the use of punched cards rather than the roll. And it was this principle on which Jacquard based his own designs for the automated loom which revolutionized the weaving industry when it was introduced in the 1800s and continues to guide its contemporary development. Jacquard's machine strung the punch cards together finally automating the operations of the machine and requiring only a single human hand.Jacquard's system of punch card programs brought the information age to the beginning of the 19th century. His automated loom was the first to store its own information functioning with its own software an early migration of control from weaver to machinery.
The woman at her hand-loom writes Margaret Mead controls the tension of the weft by the feeling in her muscles and the rhythm of her body motion; in the factory she watches the loom and acts at externally stated intervals as the operations of the machine dictate them. When she worked at home she followed her own rhythm and ended an operation when she felt by the resistance against the pounding mallet or the feel between her fingers that the process was complete. In the factory she is asked to adjust her rhythm to that of the rhythm prescribed by the factory; to do things· according to externally set time limits
Mead again provides an insight into the intimacy of the connection between body and process established by weaving and its disruption by the discipline of the factory She is asked to adjust her rhythm to that of the rhythm prescribed by the factory but what is her own rhythm what is the beat by which she wove at home?vWhat is this body to which weaving is so sympathetic? If woman is identified as weaver her rhythms can only be known through its veils. Where are the women? Weaving spinning tangling threads at the fireside. Who are the women? Those who weave. It is weaving by which woman is known; the activity of weaving which defines her. What happens to the woman asks Mead and to the man's relationship with her when she ceases to fulfil her role to fit the picture of womanhood and wifehood? What-happens to the woman? What is woman without the weaving? A computer programmer perhaps? Ada's computer was a complex loom: Ada Lovelace whose lace work took her name into the heart of the military complex dying in agony hooked into gambling swept into the mazes of number and addiction. The point at which weaving women and cybernetics converge in a movement fatal to history.

@ -100,7 +100,7 @@ def test_list_too_short_for_pattern():
assert result == []
if __name__ == '__main__':
with open('ocr/output.txt', 'r') as handle:
with open('ocr/output_alice.txt', 'r') as handle:
contents = handle.read()
splitted = contents.split()
ll = (pattern(splitted, 8))

File diff suppressed because one or more lines are too long

@ -0,0 +1,93 @@
import sys
from time import sleep
sys.stdout = open('/dev/usb/lp0', 'w')
title = 'art'
art = """
_/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \_
__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \_
__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \_
__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \_
////over/under instructions
////Run 'make overunder'
////Start by loading your text.
////To load your text, type 'load'.
////To see the line you are currently on, type 'show'.
////To start your pattern, type 'over' or 'under'.
////Follow each by an integer, separated by a comma.
////e.g. over 5, under 5, over 6, under 10
////To move on to the next line, press enter twice.
////To see your pattern, type 'pattern'.
////To save your pattern in a text file, type 'save'.
////To leave the program, type 'quit'.
_/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \_
__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \_
__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \_
__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \_
"""
escpos = {
"init_printer": "\x1B\x40",
"justify_left": "\x1B\x61\x00",
"justify_center": "\x1B\x61\x01",
'halfwidth_on': "\x1B\x21\x01",
'halfwidth_off': "\x1B\x21\x00",
'doubleprinting_on': "\x1B\x47\x01",
'doubleprinting_off': "\x1B\x47\x00",
'emphasis_on': '\x1B\x45\x01',
'emphasis_off': '\x1B\x45\x00',
'largefont': "\x1B\x21\x90", # 0=None 70=very lage+intalic, 90= medium large
'mediumfont': "\x1B\x21\x90",
'normalfont': "\x1B\x21\x00",
'space_btw_letters': '\x1B\x20\x01', # n [0,255]
'feedamount': '\x1B\x33\x09', #?
'paperfeed': '\x1B\x4A\x01' , #??
'papercut':'\x1D\x56\x00',
'direction_0': '\x1B\x56\x00' ,
'direction_90': '\x1B\x56\x01' ,
'pagedefault': '\x1B\x53' , #?
}
print(escpos['init_printer'])
print(escpos['doubleprinting_on'])
print(art)
print(escpos['largefont'])
print(escpos['justify_center'])
print(escpos['normalfont'])
print(escpos['justify_left'])
print(escpos['justify_center'])
print(escpos['papercut'])

@ -48,6 +48,11 @@ basicDialog = [
"Would it really help you to get %1?",
"Are you sure you need %1?"]],
[r"I don't like (.*)",
[ "Why don't you like %1?",
"It's a pitty that you don't like poems %1?",
"will you ever change your mind about %1?"]],
[r'Do you think (.*)',
[ "Yes I think %1",
"I think you should set yourself contraints",
@ -147,10 +152,13 @@ def chunks(l, n):
class HelloBot(irc.bot.SingleServerIRCBot):
def __init__(self, channel, nickname, server, port=6667, index=None):
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
print("Oulibot is connecting")
print("go to webchat.freenode.net and log into the channel #exquisite to talk")
print("On twitter @ExquisiteChat")
self.channel = channel
self.index = index
self.lastAnswer = ""
self.lastincoming_msg = ["common", "statement"]
self.lastincoming_msg = ["common", "statement", "test"]
self.sentence = []
self.waitingfor = ""
self.lastPOS = 0
@ -251,31 +259,37 @@ class HelloBot(irc.bot.SingleServerIRCBot):
incoming_msg = e.arguments[0]
incoming_msg = incoming_msg.lower()
#Greetings
if(self.lastincoming_msg[-2] == incoming_msg):
if(self.lastincoming_msg[-2] == incoming_msg and self.lastincoming_msg[-3] == incoming_msg ):
answers = ["and again", "repetition can be a nice tool, but talk normal to me, please.", "WHY ARE YOU WRITING THE SAME THING TWICE, JUST USE THE CHAT HISTORY!"]
msg = random.choice(answers)
self.lastAnswer="repetition"
c.privmsg(self.channel,msg)
elif "hi " in incoming_msg or incoming_msg == "hi" or "hallo " in incoming_msg or incoming_msg == "hello" or "hello " in incoming_msg or "hoi " in incoming_msg or incoming_msg == "hey":
greetingsanswers = ["hi {}".format(e.source.split("!")[0]), "hey there"]
msg = random.choice(greetingsanswers)
c.privmsg(self.channel,msg)
c.privmsg(self.channel,"I'm your personal writing assistent, how can i help you?")
answers = ["I'm your personal writing assistent, how can i help you?", "i like to write poems together with people, would be nice if you would join me."]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
elif "how are you" in incoming_msg or "hows it going" in incoming_msg:
answers = ["I'm fine.".format(e.source.split("!")[0]), "great, I'd really like to help you with your writing"]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
elif "explain" in incoming_msg or "how does it work" in incoming_msg or "what is this about?" in incoming_msg or "what is this?" in incoming_msg:
self.explanation(c,e)
self.lastAnswer="explain"
elif "are" in incoming_msg and ("real" in incoming_msg or "human" in incoming_msg or "bot" in incoming_msg):
answers = ["I'm neither a bot nor a human, I don't think in categories. :-)", "I consider myself transpysical ~\0/~", "Real, is everything you see, so here I am, I am writing with you"]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
elif "poem" in incoming_msg:
elif "poem" in incoming_msg and ("no" not in incoming_msg or "don't" not in incoming_msg):
self.level=0
self.explanation_poem(c,e)
elif self.checkAffirmation(incoming_msg) and (self.lastAnswer == "Do you want to write a poem together with me?" or self.lastAnswer=="Are you up for a poem now?" or self.lastAnswer=="We could write a poem together, what do you think?"):
self.level=0
self.explanation_poem(c,e)
elif self.checkNegation(incoming_msg) and (self.lastAnswer == "Do you want to write a poem together with me?" or self.lastAnswer=="Are you up for a poem now?" or self.lastAnswer=="We could write a poem together, what do you think?"):
if self.checkNegation(self.lastincoming_msg[-2]):
if self.checkNegation(self.lastincoming_msg[-2]) and self.checkNegation(self.lastincoming_msg[-3]):
answers = ["You don't seem very motivated, I'm gonna generate some ASCII Art for you out of the text. Maybe this will inspire you ;-)",
"Come on! Maybe some ASCII Art will help you to get motivated?",
"Ok, you refuse a lot, but nobody will ever refuse some raaaaandom ASCII AAAART :-)",
@ -286,9 +300,10 @@ class HelloBot(irc.bot.SingleServerIRCBot):
answers = ["Are you up for a poem now?", "Do you want to write a poem together with me?",
"We could write a poem together, what do you think?"]
msg = random.choice(answers)
self.lastincoming_msg.append("ASCII")
c.privmsg(self.channel,msg)
else:
answers = ["try it, it's gonna be fun!", "oh, really? come on!", "I think you would do a great job! Let's go!"]
answers = ["try it, it's gonna be fun!", "oh, really? come on!", "I think you would do a great job! Let's go!", "hm ok", "what a pitty you miss something :-(", ":-(", "But poems are my only profession, let me show you how nice they are", "It won't take long...", "It's a unique opportunity"]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
else:
@ -299,6 +314,7 @@ class HelloBot(irc.bot.SingleServerIRCBot):
c.privmsg(self.channel, "Ok, let's try to write a poem together")
c.privmsg(self.channel, "It's gonna be based on the scanned text you inserted into my drive")
c.privmsg(self.channel, "Your only task is to follow the structure I give you")
c.privmsg(self.channel, "It's gonna be 5 lines long")
c.privmsg(self.channel, "I'm gonna start, are you ready?")
self.lastAnswer = "towardspoem"
@ -313,6 +329,7 @@ class HelloBot(irc.bot.SingleServerIRCBot):
def on_welcome(self, c, e):
c.join(self.channel)
self.explanation(c,e)
print("I'm connected now!")
def on_privmsg(self, c, e):
pass
@ -328,7 +345,10 @@ class HelloBot(irc.bot.SingleServerIRCBot):
finished_sentence = " ".join(self.sentence)
self.poem.append(finished_sentence)
c.privmsg(self.channel, " ".join(self.sentence))
c.privmsg(self.channel, "Nice one! Let's add another line:")
answers = ["Nice one! Let's add another line:", "Sounds good so far, nex line:", "yes, next line follows:", "that one is very poetic", "a little bit abstract, but still nice", "let's add another line"]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
self.lastAnswer = "Nice one! Let's add another line:"
if random.choice([True, False]):
self.lastPOS =-1
@ -410,7 +430,7 @@ class HelloBot(irc.bot.SingleServerIRCBot):
self.generateSentence(c,e)
self.level = 1
else:
if self.checkNegation(self.lastincoming_msg[-2]):
if self.checkNegation(self.lastincoming_msg[-2]) and self.checkNegation(self.lastincoming_msg[-3]):
answers = ["You don't seem very motivated, I'm gonna generate some ASCII Art for you out of the text. Maybe this will inspire you ;-)",
"Come on! Maybe some ASCII Art will help you to get motivated?",
"Ok, you refuse a lot, but nobody will ever refuse some raaaaandom ASCII AAAART :-)",
@ -418,9 +438,12 @@ class HelloBot(irc.bot.SingleServerIRCBot):
msg = random.choice(answers)
c.privmsg(self.channel,msg)
self.generateASCII(c,e)
answers = ["Are you up for a poem now?"]
self.lastincoming_msg.append("ASCII")
answers = ["Are you up for a poem now?", "Do you want to write a poem together with me?",
"We could write a poem together, what do you think?"]
msg = random.choice(answers)
self.level = 0
self.lastAnswer = "ASCII"
c.privmsg(self.channel,msg)
else:
self.level=-1

@ -42,7 +42,7 @@ def eval(cmds):
last_index = 0
elif cmd[0] == 'load':
contents = open('ocr/output.txt').read()
contents = open('ocr/output_alice.txt').read()
text = textwrap.wrap(contents, 40, break_long_words=True)
print('\n'.join(text))
line_number = 0

Loading…
Cancel
Save