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

Improve ranking algorithm for triggers with no words #94

Closed
htdinh opened this issue May 31, 2017 · 2 comments
Closed

Improve ranking algorithm for triggers with no words #94

htdinh opened this issue May 31, 2017 · 2 comments

Comments

@htdinh
Copy link
Contributor

htdinh commented May 31, 2017

  1. Issue: The current sorting algorithm fails again when the trigger with no text (trigger 2 below) takes precedence over the trigger with text (trigger 1). This undesired sorting is not seen in both Python release v1.14.4 (prior to new sorting algorithm) and JavaScript version (tested in https://www.rivescript.com/try).
+ hi [*]
- 1
+ _ _
- 2
  1. Explanation of the behaviour: This is because the binary presence of words (yes, no) is not taken properly. This was handled with star such that single star * and its variance [*] would be placed last in the sorting.
  2. Solution: Create a new variable to indicate the presence of words. Make this the first sorting criteria. Within each group (with and without words), we apply the old sorting algorithm.
htdinh pushed a commit to htdinh/rivescript-python that referenced this issue May 31, 2017
htdinh pushed a commit to htdinh/rivescript-python that referenced this issue May 31, 2017
…words in trigger and take this attr into consideration of multi-sorting
htdinh pushed a commit to htdinh/rivescript-python that referenced this issue May 31, 2017
htdinh pushed a commit to htdinh/rivescript-python that referenced this issue May 31, 2017
htdinh pushed a commit to htdinh/rivescript-python that referenced this issue May 31, 2017
@htdinh
Copy link
Contributor Author

htdinh commented May 31, 2017

The change in this issue would also change the ranking order of [*] and *, which is recently handled in #92. Since the two triggers are serving the same purpose (match any string including empty one), they should not appear in the same script, therefore the order between them is not strict as long as they both secure the last places in the ranking.

kirsle added a commit that referenced this issue May 31, 2017
@kirsle
Copy link
Member

kirsle commented May 31, 2017

Fixed in PR #95

@kirsle kirsle closed this as completed May 31, 2017
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

No branches or pull requests

2 participants