段落があるとします:
text = '''Darwin published his theory of evolution with compelling evidence in his 1859 book On the Origin of Species, overcoming scientific rejection of earlier concepts of transmutation of species.[4][5] By the 1870s the scientific community and much of the general public had accepted evolution as a fact. However, many favoured competing explanations and it was not until the emergence of the modern evolutionary synthesis from the 1930s to the 1950s that a broad consensus developed in which natural selection was the basic mechanism of evolution.[6][7] In modified form, Darwin's scientific discovery is the unifying theory of the life sciences, explaining the diversity of life.[8][9]'''
単語 (優先) を入力した場合、その単語が含まれる文全体を削除するにはどうすればよいでしょうか。以前に使用した方法は面倒でした。sent_tokenize を使用してパラ (13000 語以上) を分割し、1000 語以上をチェックする必要があったため、ループを実行して各文の各単語をチェックしました。400以上の文章があるので、これには多くの時間がかかります。
代わりに、パラでこれらの 1000 語をチェックしたいと思います。単語が見つかったら、前のすべての単語をピリオドまで選択し、後のすべての単語をピリオドまで選択します。