Closed hamidreza01 closed 1 year ago
This feature hasn't been implemented outside the JavaScript version of RiveScript; there it was added because JS regular expressions have Unicode issues where a + [*] keyword [*]
style trigger didn't translate properly if the keyword was Unicode symbols (the \b word-boundary metacharacter in JavaScript only binds to latin A-Za-z0-9 characters).
If you'd like to submit a pull request to bring this to rivescript-go, the JavaScript implementation was here: https://github.com/aichaos/rivescript-js/blob/423cd4ac41ecc4f837639ee8bc8d2163bf61860b/src/parser.js#L200-L219 and some background in its pull request: https://github.com/aichaos/rivescript-js/pull/256
It basically translates the ?
command into a +
trigger which turns the keyword into various permutations of optional wildcards [*]
or regular wildcards *
on either side as a sort of hacky work-around for the JavaScript Unicode issue. For Go, the ?
command could probably just translate to a regular + [*] keyword [*]
trigger since Go didn't have the regular expression matching issues.
Or I'll leave this ticket open and implement a fix when I can.
Thank you for your detailed explanation, the exact problem you described in javascript also exists in Go, it would be great if you could add this. And another issue, how can you directly use regex in rive(go) ?
This is fixed now as of v0.4.0 of rivescript-go with the addition of the ?Keyword command: https://github.com/aichaos/rivescript-go/pull/48
Hi, this operator (?) in goo language causes errors .