"js": ["base.js", "counit.js", "mark.js", "armsml.js"]
if __name__ == "__main__":
stemmer = Stemmer()
f1 = open("First.txt",mode = 'r',encoding = 'utf-8')
for line in f1:
word1 = (line)
word = str(word1)
word = stemmer.stem(word)
#Очистим от пустых строк
if word[-1] == "\n":
new_word = word.replace('\n', '')
else:
new_word = word
#Теперь надо очистить мусор (пока что, все кроме слов)
if new_word.isalpha():
w2 = new_word
else:
continue
#Теперь надо очистить все русские слова
#f2 = open("zdf.txt",mode = 'r',encoding = 'utf-8')
flag = True
wdel = []
with open("base.txt", encoding = 'utf-8') as f2:
for line in f2:
if w2 in line:
wdel.append(w2)
flag = False
if flag:
w3 = w2
else:
with open('delete.txt', 'a', encoding = 'utf-8') as d:
d.write('\n'.join(set(wdel)))
ffinal = open("good.txt",mode = 'a',encoding = 'utf-8')
ffinal.write(w3 + "\n")
wdel = []
with open("base.txt", encoding = 'utf-8') as f2:
for line in f2:
if w2 in line:
wdel.append(w2)
flag = False
if flag:
w3 = w2
else:
with open('delete.txt', 'a', encoding = 'utf-8') as d:
d.write('\n'.join(set(wdel)))
d.write('\n'.join(wdel))