我想这是从Keras的新版本(2.0)即将到来的错误。更改是最近的,并且教程/文档可能不是最新的。
我们收到(like in the doc),对文本预处理功能filter=
参数的默认值是一个函数“base_filter()
”此功能将包含特殊字符的列表中删除。
在新版本中,你可以在源代码中看到,默认筛选器是不是base_filter()
功能了,但直接的列表:
def text_to_word_sequence(text,
filters='!"#$%&()*+,-./:;<=>[email protected][\\]^_`{|}~\t\n',
lower=True, split=" "):
"""Converts a text to a sequence of word indices.
# Arguments
text: Input text (string).
filters: Sequence of characters to filter out.
lower: Whether to convert the input to lowercase.
split: Sentence split marker (string).
# Returns
A list of integer word indices.
"""
看到full code here。
所以总结一下,该文档是不是最新的,功能base_filter()
不会再在Keras 2.0存在。由base_filter过滤字符简单地通过人物的名单代替:'!"#$%&()*+,-./:;<=>[email protected][\\]^_
{|}〜\ t \ n'`
我希望这有助于。
请注明您的环境,keras,后端等版本。 :) –
keras版本2.0.0我正在使用jupyter笔记本。后端是tensorflow。 – zesla
答案有帮助吗? :-)如果你还没有看到它,请看下面的内容 –