duckduckgo / zeroclickinfo-spice

DuckDuckGo Instant Answers based on JavaScript (JSON) APIs
https://duckduckhack.com/
Other
548 stars 942 forks source link

InEveryLang - Should ensure remainder contains no extra words beside specified language #1297

Closed moollaza closed 9 years ago

moollaza commented 9 years ago

The query "fizzbuzz perl foo bar baz" or similar will still trigger the FizzBuzz Spice because it only checks that a language exists in the remainder, but doesn't make sure nothing else does.

Although this is potentially useful, I believe it opens a small window to displaying False Positives and so should be fixed.

//cc @josephwegner

josephwegner commented 9 years ago

hmmm, I'd like to flesh out this idea with you guys before I start coding it up. Definitely I don't want to trigger false positives, but I do feel like there are a ton of variations of queries that would indicate the user wants to see a code example. Off the top of my head I've got:

The list could go on and on... If you guys think it's best to limit the search to a few patterns like the ones I have above, I am fine with that, but I personally think it seems like matching a puzzle name (ie: "Fizz Buzz") and a language name (ie: "Java") is a really strong indicator of intent.

But I'll defer to your judgement.

josephwegner commented 9 years ago

Perhaps a better way to go about it would be to think of things that could contain both a puzzle and a language, but where a solution spice would not be expected. What kinds of real world queries would trigger false positives?

FizzBuzz Java Interview Question might be on, but I'm not even sure about that. Ideas?

moollaza commented 9 years ago

@josephwegner our general mantra towards IA's is that False Positives are to be avoided at all costs, for now this sometimes means limiting the queryspace of an IA so that we're really sure we should be showing the result for the given query.

They types of queries you listed are all pretty great. We can build an exhaustive list of them and either set them as the various triggers of the IA, or build a regex that verifies the query after triggering on a more generic trigger (like FizzBuzz, which is how it's currently setup).

I'm happy with either choice.

FWIF, triggering is an aspect of IA's that we're planning to focus a lot more on in the coming year. Right now we don't have a good way to detect possible false positives or possible false negatives (places where an IA should be triggering, but isn't) -- Hopefully we'll be able to improve our detection of those and move towards better triggers for all IA's

josephwegner commented 9 years ago

Makes sense.

I'll do some more thinking on things that definitely should trigger, and then update the IA.

I will probably do the false-positive detection in the handler - I think the regexp for the trigger could get horrendously messy if I try and pack this logic in there.

moollaza commented 9 years ago

I will probably do the false-positive detection in the handler - I think the regexp for the trigger could get horrendously messy if I try and pack this logic in there.

Yes, sorry I don't mean that we should use a regex trigger -- using trigger words is always preferred -- its just that the two routes most Spices go is either building an exhaustive list of exact triggering phrases and using those as the triggers, or using a few generic triggers and in the handle, determine if the query is what we want.

Thanks again @josephwegner !

josephwegner commented 9 years ago

Solved by https://github.com/duckduckgo/zeroclickinfo-spice/pull/1320

moollaza commented 9 years ago

Thanks!