Answer the question
In order to leave comments, you need to log in
How to change the emotional coloring of the text?
How can the emotional coloring of the first text be changed to the second? through the algorithm and matrix.
I enter two texts and try to replace the second with the first. So that the program reads each word, skips if there is a word and changes it to another (from the second) if it does not repeat.
Answer the question
In order to leave comments, you need to log in
xs of course, did I understand correctly what you want
and the initial conditions are not clear
if it’s stupid in the forehead and with the restrictions that you have, then you can
c = set(text1.split()).difference(set(text2.split()))
for i, w in enumerate(text1.split()):
if w in c:
print("{} -> {}".format(w, text2.split()[i]))
else:
print(w)
Сергей
сегодня
получил
двойку -> отлично
на
уроке.
Дома
ждет
его
наказание. -> подарок.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question