-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trim user's sentence #53
Conversation
caution : third sentence had a leading blank not kept by the chat.: |
@@ -398,7 +398,8 @@ class Brain | |||
else | |||
# For everything else, strip all non-alphanumerics | |||
msg = utils.stripNasties(msg, @utf8) | |||
|
|||
# cut leading and trailing blanks | |||
msg = utils.trimWhitespace(msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In coffeescript, indentation levels are important. These lines should be indented to the same level as the return
statement.
Also, String.prototype.trim()
is already built into the language, so this line can be replaced with:
msg = msg.trim()
This reverts commit 8397393.
Hi Kirsle, hope this is correct. |
@@ -398,7 +398,9 @@ class Brain | |||
else | |||
# For everything else, strip all non-alphanumerics | |||
msg = utils.stripNasties(msg, @utf8) | |||
|
|||
|
|||
# cut leading and trailing blanks once punctuation dropped office |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent this comment line too.
Done:.same thing: i must leave my editor to show special char as tab , i can't see by default. |
relates to a post https://www.chatbots.org/ai_zone/viewthread/2314/
Rivescript doesn’t cut the trailing blanks after cleaning punctuation symbols and leading blanks give also problems;
for example, with :
if user enter :
do you love me ? (with a blank before ? ), this doesn’t match
do you love me? works well
do you love me? doesn’t match
I add this branch to add the trim once punctuation has been treated.
Everything comes back to : do you love me and is ok.
-> as this is my first Coffee script, my first github pull and my first rivescript test, be indulgent !
HTH