# File stringDemo2b.py # This file uses a dedicated module stringDemos # Author: G.Doeben-Henisch # First date: July 19, 2019 ''' ACTOR STORY 1. There is a user (as executive actor) who can enter single or multiple words into the input interface of an assisting interface. 2. After confirming the input the assisting actor will respond in a creative manner. These creativity is manifested in changed orders of symbols and words as well as by replaced symbols. 3. After the response the user can either repeat the sequence or he can stop. If repeating then he can select between two options: (i) enter manually new words as input or (ii) redirect the output of the system as new input. This allows a continuous creative change of the words. 4. The repeated re-direction offers again two options: (i) Closed world; no real input; (ii) Open world; some real new input ''' ############################ # IMPORTS import random as rnd import stringDemos as sd ############################ # SUPPORTING FUNCTION # # Now in a dedicated module stringDemos.py in folder 'code' # Complete path: C:\Users\gerd_2\code # This path has to be included for the python path search mechanism # # Show actual path values # # >>> import sys #>>> sys.path # ... # Extend the python path by appending the modul path: # #>>> sys.path.append('C:\\Users\\gerd_2\\code') ########################## # Main Programm ############### # Start main loop # # The loop will work as long as the value of the variable 'loop' is different to 'N' loop='Y' while loop!='N': ################### # The user is invited to give some ordering decisions: # 'Closed' world means that the set of participating letters will not be expanded # 'Open' world means that the set of participating letters will be expanded opt=input("Single word = '1' or Multiple words = '2'\n") opt2=input("New manual input ='1' or Redirect the last output = '2'\n") opt3=input("Closed world ='1' or Open world ='2'\n") if opt=='1' and opt2=='1' and opt3=='1': w1=input('Input a single word\n') print('Your input word is =',w1) # Here you need a function which # (i) re-orders the sequence of symbols in the word -> worder() wnew=sd.worder(w1) # (ii) replaces a symbol by some randomly selected new one -> sd.wreplace() # wcreative() = worder() ^ sd.wreplace() elif opt=='1' and opt2=='2' and opt3=='1': print('The last output was =',wnew) # Here you need a function which # (i) re-orders the sequence of symbols in the word -> worder() wnew=sd.worder(wnew) elif opt=='1' and opt2=='2' and opt3=='2': print('The last output was =',wnew) # Here you need a function which # (i) re-orders the sequence of symbols in the word -> worder() wnew=sd.worder(wnew) # (ii) replaces a symbol by some randomly selected new one -> sd.wreplace() wnew=sd.wreplace(wnew) # wcreative() = worder() ^ sd.wreplace() elif opt=='2' and opt2=='1' and opt3=='1': w1=input('Input multiple words\n') print('Your input words are =',w1) # Here you need a function which # (i) re-orders the sequence of words -> sd.sqorder() wnew=sd.sqorder(w1) # (ii) reorder the symbols in each word -> sd.mcworder() wnew=sd.mcworder(wnew) # (iii) replace in each word randomly a symbol -> sd.wreplace() # sqcreative() = sd.sqorder ^ wcreative() elif opt=='2' and opt=='2' and opt3=='1': print('The last output was =',wnew) # Here you need a function which # (i) re-orders the sequence of words in the word-sequence -> sd.sqorder() wnew=sd.sqorder(wnew ) # (ii) reorder the symbols in each word -> sd.mcworder() wnew=sd.mcworder(wnew) elif opt=='2' and opt=='2' and opt3=='2': print('The last output was =',wnew) # Here you need a function which # (i) re-orders the sequence of words in the word-sequence -> sd.sqorder() wnew=sd.sqorder(wnew ) # (ii) reorder the symbols in each word -> sd.moworder() wnew=sd.moworder(wnew) # Clarify how to continue loop=input("STOP = 'N', CONTINUE != 'N' \n")