ColorCodes: Triggers on any query ending in "color <name>" #3294
Comments
@moollaza Ok, I'm working to solve it |
Here's a visualization of the regex: source: https://www.debuggex.com/r/nAmQuV7VMZBpqOKF You can see that it's possible to have any string before "color red" because of the |
@moollaza In this moment IA ColorCodes is supporting the queries "rgb color code for red" and "red color code for html" etc. |
Maybe we need to be tighter with the regex and enforce "color code" being in the query, code not being optional? |
@Mailkov I think we should break apart that big regex so it's easier to understand and then replace the Or maybe as a heuristic if the string doesn't contain "color code", but contains a named colour and other words, we should bail out? @gaulrobe I'm not sure we want to be so strict as to require "color code" just yet. The IA is just a little too flexible with it's triggering right now. |
@moollaza it might help to require it in cases where "color" is in the query, since that is gonna be very ambiguous. "color code" at least is explicit in what is being asked. But either way, maybe too early to go that far. 😄 |
@gaulrobe ah sorry I misunderstood you! It looks like there are a few common search forms that just contain An alternative approach is to remove words and phrases we expect to be in the query and if the result is a valid colour name or code then we could trigger. Ultimately I think we need to break up the logic we use to evaluate the query so it's easier to reason about, and then add more tests! |
BTW I just noticed that "#E0E0E0 color" and "#E0E0E0 css color" don't trigger this Instant Answer -- they definitely should! |
Ping! I'm just checking in to see if anyone is still interested in finishing this one up? |
color: "your color"; |
- Added logic to prevent triggering when excess words are involved in the sentence that are not expected Fixes duckduckgo#3294
* ColorCodes: Triggers on any query ending in "color <name>" - Added logic to prevent triggering when excess words are involved in the sentence that are not expected Fixes #3294 * - Fixed regex for filler words to be simpler - Fixed filler count return statement by removing the double negative * Simplified regex to catch filler words * Fixed whitespace changes * Added more tests for when the IA should not trigger. Existing tests already sufficiently cover when the IA should trigger.
Description
This IA is triggering for any query that ends in
color <name>
causing some irrelevant results.e.g. https://duckduckgo.com/?q=symbolism+of+the+color+red&ia=answer
We need to verify that the query doesn't contain other words when the trigger is
color
People to notify
/cc @mintsoft
Get Started
Resources
IA Page: http://duck.co/ia/view/color_codes
Maintainer: @Mailkov
The text was updated successfully, but these errors were encountered: