2

I write "hi hello", after cleaning whitespace using chatterbot.preprocessors.clean_whitespace I want to show my input as "hihello", bt chatterbot replies me another answer. How can I print my input after preprocessing?

1 Answers1

0

The clean_whitespace preprocessor in ChatterBot won't remove all white space, just preceding, trailing, and consecutive spaces. It cleans the white space, it doesn't remove it entirely.

It sounds like you want to create your own preprocessor. This can be as simple as creating a function like this:

def remove_whitespace(chatbot, statement):

    for character in ['\n', '\r', '\t', ' ']:
        statement.text = statement.text.replace(character, '')

    return statement
Gunther
  • 2,474
  • 4
  • 31
  • 45