Page MenuHomePhabricator

Build an API and/or a tool to surface section recommendations
Closed, ResolvedPublic


Useful Links

Implementation details

The initial implementation will have two separate end points for each of category-based and language-based recommendations. Later, when we're able to combine the results from these two systems into one, an API endpoint will be created for the combined recommendations.

A/C (will change as things become clearer) or

  • Create an end-point for article based recommendations for frwiki:

  • Create an end-point for translation based recommendations.
  • Create a gadget to surface section recommendations. has the gadget. Login and enable it to test it.

Related Objects

Event Timeline

leila triaged this task as High priority.Dec 15 2017, 9:43 PM
leila created this task.

Change 403938 had a related patch set uploaded (by Bmansurov; owner: Bmansurov):
[mediawiki/services/recommendation-api@master] WIP: Add support for category-based section recommendations

@bmansurov these look good to me. Thanks.

@tizianopiccardi can you confirm that the relevance scores for the example recommendations is what you expect to see?

@tizianopiccardi can you confirm that the relevance scores for the example recommendations is what you expect to see?

Yes, the recommendations match with the dataset I generated.

We have a gadget now. Follow these steps to see it in action:

  1. Create an account at
  2. Enable the 'gapfinder' gadget at
  3. Visit one of the articles below to see section recommendations (recommendations will appear just below the article title):

Note that it may take a little time before you see suggestions. Also, since this is the first iteration, we're only showing the recommendations in the read view. The next iteration will suggest these recommendations in the edit view. Also note that, only the top 5 recommended sections are being shown.

@bmansurov great great. :)

Shall we share a page somewhere where we can drop the issues and discuss how we can fix them? (etherpad or wiki both work). For example, in , I'm not sure why Chart performance is recommended while the section is already in the article. Also, Tiziano may want to see what's going wrong in, I'm guessing a bad category has made it to the pruned network.

@leila an etherpad should be enough for now.

As for the "Bring You Back" article, I think the issue is with the code, not data. I'll look into it on Monday.

Yes, it'be great if @tizianopiccardi can look at Georgians. To briefly explain, the sections are coming from all categories of that article. Not sure which ones are ultimately responsible for the unfit sections.

I've updated the gadget to display section recommendations while editing an article. See, for example. Here's a screenshot:

scrot-area-2018-02-02_16:20:53.png (780×1 px, 99 KB)

I've updated the gadget to display section recommendations while editing an article. See, for example.

Great. @bmansurov In terms of the design, are you planning to gradually move towards the ones at T160177 ? If yes, I can start talking with Pau to expand to those designs for us. We discussed a couple of things we want to have:

  • Context for the recommendation
  • A way for the user to report the recommendation

Here's a screenshot:

scrot-area-2018-02-02_16:20:53.png (780×1 px, 99 KB)

@diego check the above. It's a good example for why we need T183037. ;)

@leila yes, I'll try to follow the design mock ups.

French recommendations have been imported. The data is available via the API, e.g.

quick comment: from this results

Maybe there is an issue with encoding. The first recommendation is "Notes et ru00e9fu00e9rences", that already exist in the French article ( . This might be an important issue for French and other languages. It would be good to see where this bug is coming from. @bmansurov @tizianopiccardi

@diego you're right. The service doesn't filter out existing recommendations because it doesn't take revid into account. Only gadget can show missing sections for now.

As for the encoding issue, we'll deal with it soon too.

The gadget has been updated. It's being shown next to the editor now.

@leila article based suggestions end point can return tens or hunderds of section suggestions depending on the number of categories an article belongs to. For example Barack Obama returns 140 suggestions. Do we want to limit the number of suggestions to, say top 25 by relevance score? We can do so by default and still let users query the full set of suggestions with an additoinal query parameter.

@bmansurov at the moment, it's best to let the API surface all of them by default. I expect some traffic to the API in the coming days/weeks for exploring the recommendations. After this initial phase, we should discuss what kind of surfacing functionality would make sense. I think the top n and the bottom m can be both interesting.

one question: would it be possible to break the lines so each recommendation is in one line? That can make the output of the API more readable for ppl?

@leila got it.

As for making the output easy to read, I could do it on the server side. I, however, suggest you use one of the extensions available for your browser. For example, JSONView is available for Chrome and Firefox. Let me know if it doesn't solve your problem.

@bmansurov We can call this task for the purposes of Q3 done. If you agree, please move it to Done.

Translation based section recommendations will be done in a separate task once the models are ready. See T190770 and T184212.

DarTar edited projects, added Research-Archive; removed Research.

Change 403938 abandoned by Bmansurov:
WIP: Add support for category-based section recommendations

Our priorities have changed. We'll pick this patch up later if need be.