123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #!/usr/bin/python
- # this is a shebang: https://en.wikipedia.org/wiki/Shebang_%28Unix%29
- import random
- #prefixes = prefixe1+ prefixe2+ prefixe3+ prefixe4 : chaîne de caractère / phrase
- #print ( type(nom_du_variable)) :pour savoir quel type d'objet
- prefixes = [
- "mono",
- "uni",
- "anti",
- "sub",
- "cyber",
- "para",
- "auto",
- "post",
- "inter",
- "homo"
- ]
- print (prefixes)
- #jusque là c'est bon
- #print (prefixe1)
- #intégrer une sentence
- #myfile = open ("which_spites.txt", 'r')
- #sentence = myfile.read()
- #myfile.close()
- phrase = "Thus have I politicly begun my reign, And 'tis my hope to end successfully.\
- My falcon now is sharp and passing empty. And till she stoop she must not be full-gorg'd, for then she never looks upon her lure. Another way I have to man my haggard, to make her come, and know her keeper's call, that is, to watch her, as we watch these kites that bate and beat, and will not be obedient. She eat no meat to-day, nor none shall eat; last night she slept not, nor to-night she shall not; as with the meat, some undeserved fault I'll find about the making of the bed; and here I'll fling the pillow, there the bolster, this way the coverlet, another way the sheets; Ay, and amid this hurly I intend that all is done in reverend care of her and, in conclusion, she shall watch all night; and if she chance to nod I'll rail and brawl and with the clamour keep her still awake. This is a way to kill a wife with kindness, and thus I'll curb her mad and headstrong humour. He that knows better how to tame a shrew, now let him speak; 'tis charity to show."
- print("1ere réplique:", phrase)
- nouvelle_phrase = []
- sortie = ''
- lettres_seules = []
- longueur_mini = 6
- mots = phrase.split()
- print("réplique séparé:",mots)
- for mot in mots:
- # si le mot est assez long
- if ( len(mot) >= longueur_mini ) :
- print('mot à préfixer : ' + mot)
- nouvelle_phrase.append( random.choice( prefixes ) + mot )
- else:
- nouvelle_phrase.append( mot )
- # lettres_seules = list(mot)
- # print("tentative de lettre:", lettres_seules)
- # print (len(mot))
- # length = len(mot)
- # if length >= 4 :
- print(nouvelle_phrase)
- print('---')
- for mot in nouvelle_phrase:
- sortie = sortie + mot + ' '
- print(sortie)
- #for mot in mots:
- #length >= 4= list (mot)
- # mots_length4= length >= 4= list (mot)
- # print ("listes mots choisis:", mots_length4)
- #
- # nouveau_mot= prefixe+mot
- # print(nouveau_mot)
- # nouvelle_phrase.append(nouveau_mot)
- #len(mot) : "combien de lettres compose chaque mot?"
- #length = len(mot) : "LA LONGUEUR DU MOT"
- #if length >= 4 : "si mon mot est plus grand que 4..."
- #print (length, mot) "... me le montrer" : rajouter un script dans le script pour l'ensemble des actions; trouver, déinir, classer...
- #définir la liste de mot correspondante:
- #c'est devenu les mots de plus de ' lettres'
- #print(nouvelle_phrase)
- #print("phrase mono-", " ".join(nouvelle_phrase))
- #séparer chaque mot
- #choix d'un prefixe parmis le stack de prefixe
- #indiquer au prefixe qu'il precede le mot
- #pour export
- with open('export.txt','w')as f:
- f.write(dictee_genetic)
|