Skip to content
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

fix(nlu): trim entity occurences on change #223

Merged
merged 2 commits into from
Dec 14, 2021
Merged

Conversation

franklevasseur
Copy link
Member

@franklevasseur franklevasseur commented Dec 10, 2021

fixes DEV-1217
fixes botpress/v12#1215

entities_trim

@franklevasseur franklevasseur marked this pull request as draft December 10, 2021 21:43
@linear
Copy link

linear bot commented Dec 10, 2021

DEV-1217 [BUG] Entity creation with leading and trailing white spaces (botpress/botpress botpress/v12#1215)

Describe the bug
It is possible to create the same entity using leading and trailing white spaces, they are all treated as the same one, but later causes issue in comparisons ex.: (if entity === 'one')

To Reproduce
Steps to reproduce the behavior:

  1. create a list entity
  2. add "one" -> no space
  3. add " one" -> space before
  4. add " one " -> space before and after
  5. add "one " - space after
  6. add "one" -> here we get a "duplicate error"

Expected behavior
Trimmed entities

Screenshots
image

Environment (please complete the following information):

  • 12.16.3

Additional context
Add any other context about the problem here.

@franklevasseur franklevasseur marked this pull request as ready for review December 10, 2021 21:54
rob-gordon
rob-gordon previously approved these changes Dec 13, 2021
Copy link
Contributor

@rob-gordon rob-gordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be easier to compare against trimmed strings in isUniqueInEntity and then update untrimmed strings once on save, rather then on each onChange event - but N/B

Looks good!

@franklevasseur franklevasseur merged commit 6588327 into master Dec 14, 2021
@laurentlp laurentlp mentioned this pull request Jan 14, 2022
@laurentlp laurentlp deleted the fl_trim_entities branch February 3, 2022 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Entity creation with leading and trailing white spaces
2 participants