I am using a for loop to copy words syllabilized in a new text file from another text file. The terminal freezes after copying half of the words which are 100k where each in a line without showing any errors. What is happening with the system?
from syltippy import syllabize
from collections import Counter
with open('espanol.txt', 'r', encoding = "ISO-8859-1") as DictEspanol, open('espanolSYLL.txt', 'w+') as DictEspanol2:
for word in DictEspanol:
word=str(word)
syllables, stress = syllabize(word)
DictEspanol2.write(u'-'.join(s if stress != i else s.upper() for (i, s) in enumerate(syllables)))
DictEspanol2.write("
")
DictEspanol2.close()
print('DOONNEE')
with open('espanolSYLL.txt', 'rb') as DictEspanol2, open('espanolSYLL2.txt', 'w+') as DictEspanol3:
print('done')
for word in DictEspanol2:
print('done 2')
Lettercount=word
counter = Lettercount.count('-')
print(counter)
if counter == 2:
print(word)
DictEspanol3.write(word)
DictEspanol3.write("
")
print('Donney Donney ')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…