I love speending time in nature. Whether it'is hiking through they mountains, walking on the beach, or simple sitting in a park, being outdoors makes me feel alive. There's simething about the fresh air, the sunlight, and the beauty of the naitural world that brings me a senses of peace and contentment.
word_pattern = re.compile(r'\w+')
words = word_pattern.findall(sentence)
# 构造HTML标记,将错误单词用删除线标记并且用红色标记出来,并在后面加上正确的单词
if word.lower() in ['speending', "it'is", 'they', 'simple', 'simething', 'naitural', 'senses']:
'speending': 'spending',
'simething': 'something',
marked_sentence += f'<span style="color:red; text-decoration:line-through">{word}</span><span style="color:green">{correct_word}</span> '
marked_sentence += word + ' '
<title>Error Article</title>
<p>{marked_sentence}</p>
with open('error_article.html', 'w') as f:
webbrowser.open('error_article.html')