Zeroclickinfo-goodies: Combination: Add support for "nCr" and "nPr" triggers

Created on 13 Apr 2017  路  14Comments  路  Source: duckduckgo/zeroclickinfo-goodies

Description

We should add support for queries of the format \d+ nCr \d+ and \d+ nPr \d+

Examples:

  • "20 nCr 5"
  • "18 nPr 3"

People to notify

@tagawa

Get Started

Resources


Instant Answer Page: https://duck.co/ia/view/combination

Maintainer: @richardscollin

Low Low-Hanging Fruit Perl Suggestion Triggering

Most helpful comment

@richardscollin We can return high signal for this IA to take precedence (like: https://github.com/duckduckgo/zeroclickinfo-goodies/blob/ba2760f03485f32f10de1e85c19b11415cb8528b/lib/DDG/Goodie/Constants.pm#L48 @moollaza I presume there's no issue with doing that?

All 14 comments

nCr thing is already working at present while nPr is not working.
@tagawa @moollaza You can assign this issue to me and I will finish it for nPr too.

Hi @shivam99aa - thank you for offering!

It seems that I was wrong earlier and trigger for nPr is also present in the code.
Although the behavior I am seeing while searching for ex 10 nPr 2 is that instead of showing answer it is showing news at the top by default.It is because nPr is also short for national public radio.
If I manually click on answer link then it is shown that the IA is present there. I think there is nothing that needs to be done for this issue as both triggers are present.

@moollaza @tagawa Can you please confirm this so that this issue can be closed or if there is still something that needs to be done here please update.

What are the criteria that it uses to match news articles? Is this code in an instant answer or something else? It appears that for some queries it doesn't match news articles e.g. 2 npr 1 while others it does: 10 npr 5.

If you check in the search results which are coming. There will be some result present which will match one number present in the search. This might be causing news article to come instead of IA.

Can someone update me how news gets triggered and we actually need to edit that code to not get triggered for this scenario. Combination IA is perfect and nothing needs to be done here.

@tagawa

@moollaza @tagawa Those queries are already answered :
https://duckduckgo.com/?q=10+nPr+4&t=vivaldi&ia=answer
https://duckduckgo.com/?q=10+nCr+4&t=vivaldi&ia=answer

I don't see there's anything to do here at all

@minsoft entering 10 npr 5 in my browser results in the following url: https://duckduckgo.com/?q=10+npr+5&t=fpas&iax=1&ia=news

Note that for 10 npr 4 it seems to work as expected. As @shivam99aa mentioned it looks like it depends if the news article contains one of the given numbers.

Seeing as the answer is still calculated and just in a separate clickable tab I don't think it's a big issue. It would be preferable for queries like this to default to showing the result of the calculation though. This would require changes elsewhere in whatever triggers the news instant answers or whatever selects the default shown ia.

@richardscollin We can return high signal for this IA to take precedence (like: https://github.com/duckduckgo/zeroclickinfo-goodies/blob/ba2760f03485f32f10de1e85c19b11415cb8528b/lib/DDG/Goodie/Constants.pm#L48 @moollaza I presume there's no issue with doing that?

@moollaza I don't see any point why news is set to default in this case. I think what @mintsoft said

We can return high signal for this IA to take precedence

could be a way to handle this issue.

Would it be preferable to always enable high priority or restrict it to the cases with npr and ncr as the trigger words @mintsoft @moollaza ? Either way I can make a PR with the change once I know which way is preferred.

@tagawa @moollaza Can someone comment on this issue on what will be the best approach to proceed on this?

@richardscollin I think so yes; if the IA returns an answer then I'd say the user's intention is probably to calculate the nCr or nPr rather than searching for the terms

This was migrated from an older issue, but I'm not sure how I didn't see those results before!

I've adjusted the priority in the backend. Changes should be live in an hour or so 馃憤

Thanks everyone

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tagawa picture tagawa  路  13Comments

pjhampton picture pjhampton  路  11Comments

nickrsan picture nickrsan  路  29Comments

GuiltyDolphin picture GuiltyDolphin  路  12Comments

spagy picture spagy  路  19Comments