Zeroclickinfo-goodies: ColorCodes: Triggers on any query ending in "color <name>"

Created on 22 Jun 2016  路  12Comments  路  Source: duckduckgo/zeroclickinfo-goodies

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

Bug Programming Mission Perl CSS Triggering

Most helpful comment

@gaulrobe ah sorry I misunderstood you!

It looks like there are a few common search forms that just contain color though...
drake_at_duckduckgo

hex_color_dark_brown_at_duckduckgo

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!

All 12 comments

@moollaza Ok, I'm working to solve it

Here's a visualization of the regex:

debuggex__online_visual_regex_tester__javascript__python__and_pcre_

_source: https://www.debuggex.com/r/nAmQuV7VMZBpqOKF_

You can see that it's possible to have any string before "color red" because of the (.*?) in the regex...

@moollaza In this moment IA ColorCodes is supporting the queries "rgb color code for red" and "red color code for html" etc.
So I'm not sure I will change the regex ...

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 (.*?) with words we actually expect to see.

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. :smile:

@gaulrobe ah sorry I misunderstood you!

It looks like there are a few common search forms that just contain color though...
drake_at_duckduckgo

hex_color_dark_brown_at_duckduckgo

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!

@moollaza good catch

@Mailkov Have you got a fork in progress somewhere? I don't mind picking this up if you don't have time

@mintsoft If you do, some of the test queries from #3346 might be useful to ensure it isn't over-triggering.

Ping! I'm just checking in to see if anyone is still interested in finishing this one up?

color: "your color";
or
backgroundbg color: " your color";

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nickrsan picture nickrsan  路  29Comments

moollaza picture moollaza  路  14Comments

GuiltyDolphin picture GuiltyDolphin  路  12Comments

moollaza picture moollaza  路  42Comments

rushsteve1 picture rushsteve1  路  13Comments