03

<<< home | H79.2778 - Reading and Writing Electronic Text | W2-Torbreck Australian

Torbreck Australian

excellent. This deep
drowning opens with a pleasant
well
drowning with this
dry and quite prolonged. This
drowning the will enhance
the need for more of it. I

Description:
The program generates luscious, dry and full bodied poetry from wine reviews. It’s quite simple, and attempts to exploit the form of language used in this kind of writing and how one can quite simply push it into the realm of cheap romantic poetry. The program expects a text file, cuts the line after “is” is found and prints, if “is” is not found it searches for “wine” and replaces it with “drowning”, The resulting poem is then outputted into a text file. Source wine review is found here




Code:


1
2
3
4
5
6
7
8
9
10
11
12
import sys
searchstr = " is "
searchstr2 = " wine "
for line in sys.stdin:
  line = line.strip()
  offset = line.find(" is ")
  offset2 = line.find(" wine ")
  if searchstr in line:
     print line[offset+4:]
  elif searchstr2 in line:
    line = line.replace('wine', 'drowning')
    print line[offset2+1:]