Python Keras中的文本到单词的顺序方法中是否有一种方法也可以使用';过滤器';参数

Python Keras中的文本到单词的顺序方法中是否有一种方法也可以使用';过滤器';参数,python,keras,deep-learning,nlp,Python,Keras,Deep Learning,Nlp,我已经查阅了Keras中text\u to\u word\u sequence方法的官方文档 文档中列出的代码是: keras.preprocessing.text.text_to_word_sequence(text, filters='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~\t\n', lower=True, split=' ') 我知道我们也可以通过正则表达式(使用\u sre.sre\u模式)删除停止字,如下所示: import re pa

我已经查阅了Keras中
text\u to\u word\u sequence
方法的官方文档

文档中列出的代码是:

keras.preprocessing.text.text_to_word_sequence(text, filters='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~\t\n', lower=True, split=' ')
我知道我们也可以通过正则表达式(使用
\u sre.sre\u模式
)删除停止字,如下所示:

import re
pattern = re.compile(r'\b(' + r'|'.join(stopwords.words('English')) + r')\b\s*')
phrase = pattern.sub('', phrase)
我的最小可验证示例是:

from tensorflow.keras.preprocessing.text import Tokenizer, text_to_word_sequence
text_to_word_sequence("The cat is in the hat!!!")

Output: ['the', 'cat', 'is', 'in', 'the', 'hat']
我希望输出为:

['cat', 'hat']
我的问题是:

是否有一种方法可以使用
text\u to\u word\u sequence
方法中的
filters
参数自动过滤掉停止字以及默认过滤掉的特殊字符?例如通过使用模式(
\u sre.sre\u模式
)等

['cat', 'hat']