User:Angeliki/2nd Trimester: Difference between revisions

From XPUB & Lens-Based wiki
Line 92: Line 92:


<syntaxhighlight lang="python" line='line'>
<syntaxhighlight lang="python" line='line'>
import sys
from sys import stdin
l=list('aeiou')
l=list('aeiou')
original = input('give me the poem')
# original = input('give me the poem ')
original = stdin.read()


if len(original) > 0:
if len(original) > 0:
Line 100: Line 104:
     new_word=[]
     new_word=[]
     for i in s:
     for i in s:
        if i!=l[0] and i!=l[1] and i!=l[2] and i!=l[3] and i!=l[4]:
    # or if i not in l
        if not i in l:  
           new_word.append(i)
           new_word.append(i)
     print (''.join(new_word))
     print (''.join(new_word))
Line 114: Line 119:
|''From "Knots", R.D.Laing''  
|''From "Knots", R.D.Laing''  
|}
|}


=== '''"Listening each other/ Sound poems"''' ===
=== '''"Listening each other/ Sound poems"''' ===

Revision as of 16:44, 31 January 2018

OCR

Tesseract training:

1. Install Tesseract
2. Recipe for training

Reading- Writing

Synopsis

Reader

Mini reader

Python scripts

"Python whisperer"

import nltk
import collections
import random
import sys

from sys import stdin, stderr, stdout

o = open("Synopsis_24012018.txt", 'r')
original = o.read()
tokens = nltk.word_tokenize(original)
for noun in tokens:
	noun = noun.lower()
# print (tokens)
v = open("nouns/91K nouns.txt")
nouns = v.read()
tokens_nouns = nltk.word_tokenize(nouns)
# print (tokens_nouns)
newnouns = []
for word in tokens:
	if word in tokens_nouns:
		n=tokens_nouns.index(word)
# 		# print (n)
		newnouns.append(tokens_nouns[n])
# 		# print (newnouns)

filename = 'Audiosfera-2015-Westerkamp.txt'
vocabulary = []

vocabulary_size = 1000
def read_input_text(filename):
    txtfile = open(filename, 'r') 
    string = txtfile.read()
    words = nltk.word_tokenize(string)
    # print (words)
    for word in words:
    	word=word.lower()
    	vocabulary.append(word)
    # print('Data size:', len(vocabulary))                

read_input_text(filename)
# print(vocabulary)

newsynopsis = []
for word in vocabulary:
	if word in tokens_nouns:
		newsynopsis.append(random.choice(newnouns))
	else:
		newsynopsis.append(word)
print (" ".join(newsynopsis))
Let’s not speak to anyone. Let us move on and listen. Listen for voices while walking. Listen for pauses.Listen. What sounds in your home town indicate a specific time of day? Here are such sounds from Vancouver. Listen. Mix—Sound signals, time of day. Listen for hums and motors for birdcalls and for pauses between the birdcalls. Listen for echoes. Echo under parabolic bridge. Bang on other objects that make interesting sounds—such as Henry Moore’s sculpture called Knife Edge in Queen Elizabeth Park in Vancouver. Henry Moore’s sculpture Knife Edge. Hear your breath and its rhythms your footsteps and their rhythm. Stop for a moment and listen to your thoughts. Let them pass like the sound of a car. Follow your thoughts until you cannot hear them any longer. Hear the pauses between sirens and horns and airplanes. The sounds of different seasons. Soundwalking—mix of excerpts, beaches and parks. Sounds of clothes and of wind. Listen into the distance. Stop. listening for a moment.3 Radio that Listens. Soundwalking—mix of excerpts, shopping malls. Listen as you return home. Did you hear the sounds of this walk of this time in your life? Radio That Listens In his article Radical Radio, Canadian composer R. Murray Schafer suggested that radio is not new. He writes: It existed long before it was invented. It existed whenever there were invisible voi­ces: in the wind, in thunder, in the dream. Listening back through history, we find that it was the original communication system by which gods spoke to humanity. It was the means by which voices, free from the phenomenal world, com­mu­ni­ca­ted their thoughts and desires to awestruckmortals. The divine voice, the Ursound, infinitely powerful precisely because of its invisibility, is encountered repeatedly in ancient religions and in folklore... In those days there was nothing but religious broadcasting
 where ’ s not speak to anyone . bots us clear on literature listen . listen for great poets and . listen for accordance . listen . what clear in your result and indicate a electric beings of creation ? ancestors and such place from vancouver . listen . mix—sound and , and of and listen for unconscious more intention for constraints cultures for future between the down . listen for Jacques . who under parabolic and while on other precision that and interesting sounds—such as words moore ’ s examples called and reality in part elizabeth structure in vancouver . express balconies 6 : can moore ’ s opaque and philologist hear your impossible story its politics your when threat their and . selection for a mind book listen to your like . major them form content the treat of a piece . but your human until activities message not hear them any longer . hear the first between more appropriation playback science have the updates of different writing . soundwalking—mix of how , and and text copy of well broadening of and . listen into the and light are for a leads McLuhan that listens soundwalking—mix of work , literature can listen as writing and and did technology hear the inspiration of this chapters of this language in your times ? above that listens in his once edit painting , canadian information r. and schafer suggested that takes is not new . he idea : it existed poetry before it was invented . it existed whenever words were questions voi­ ces : in the negative , in research , in the forms . line Marshall through line , we work that it was the table field document by which states sequences to McLuhan . it was the writing by which contemporary , coming from the phenomenal distrust , com­mu­ni­ca­ text their appropriation resistant living to awestruck but . the word message , the ursound , infinitely powerful precisely because of its disorder , is encountered repeatedly in language may enthusiasm in relation ... in those view one was red pieces descriptions elements

From a text of Hildegard Westerkamp

The output text with borrowed nouns from synopsis of several texts

"No_vocals poem"

import sys
from sys import stdin

l=list('aeiou')
# original = input('give me the poem ')
original = stdin.read()

if len(original) > 0:
    word= original.lower()
    s=list(word)
    new_word=[]
    for i in s:
    	# or if i not in l
        if not i in l: 
           new_word.append(i)
    print (''.join(new_word))
else:
    print ('empty')
Jack tells Jill Jill tells Jack Jack wants Jill Jill wants Jack a perfect contract Jill wants Jack to want Jill to want Jacks want ofher want for his want of her want of Jacks want that Jill wants Jack to want Jill to want Jacks want of her want for his want of her to want Jack to want
 jck tlls jll jll tlls jck jck wnts jll jll wnts jck  prfct cntrct jll wnts jck t wnt jll t wnt jcks wnt fhr wnt fr hs wnt f hr wnt f jcks wnt tht jll wnts jck t wnt jll t wnt jcks wnt f hr wnt fr hs wnt f hr t wnt jck t wnt
From "Knots", R.D.Laing

"Listening each other/ Sound poems"

import nltk
import collections
import random
import sys

from sys import stdin, stderr, stdout

def get_words(filename):
    txtfile = open(filename, 'r') 
    string = txtfile.read()
    words = nltk.word_tokenize(string)
    return words


def get_lines(filename):
    w = []
    for line in open(filename):
        if line.strip():
            w.append(line.strip())
    return w

source_words = get_words("Audiosfera-2015-Westerkamp.txt")
all_verbs = get_lines("verbs/31K verbs.txt")
print('all_verbs', 'not' in all_verbs)

source_verbs = []
for word in source_words:
    if word in all_verbs:
        source_verbs.append(word)
print ('source verbs', source_verbs)

target_words = get_words('jackjill.txt')

# print(target_words)

newsynopsis = []
# I can use a counter
for word in target_words:
    if word in all_verbs:
        # newsynopsis.append(random.choice(source_verbs))
        newsynopsis.append(source_verbs[0])
    else:
        newsynopsis.append(word)
print (" ".join(newsynopsis))
Jack tells Jill Jill tells Jack Jack wants Jill Jill wants Jack a perfect contract Jill wants Jack to want Jill to want Jacks want ofher want for his want of her want of Jacks want that Jill wants Jack to want Jill to want Jacks want of her want for his want of her to want Jack to want
 Jack hear Jill Jill make Jack Jack indicate Jill Jill dream Jack a listen wind Jill not Jack to horns Jill to voices Jacks signals of her radio for his were of her excerpts of Jacks example that Jill motors Jack to sounds Jill to desires Jacks thoughts of her thoughts for his thoughts of her to voice Jack to divine
From "Knots", R.D.Laing The output text with borrowed verbs from the text of Hildegard Westerkamp