Get content translation recommendation

GET /service/lw/recommendation/api/v1/translation

Get recommendations for articles to translate based on those that exist in a source language wiki but are missing from a target language wiki. Check this interactive documentation or try the usage examples below.

Examples

curl

Anonymous access

# Get three recommendations of articles to translate to French based on the English Wikipedia Apple article.
$ curl "https://api.wikimedia.org/service/lw/recommendation/api/v1/translation?source=en&target=fr&count=3&seed=Apple"

Python

# Python 3
# Get three recommendations of articles to translate to French based on the English Wikipedia Apple article.

import requests

inference_url = "https://api.wikimedia.org/service/lw/recommendation/api/v1/translation"
    
params = {"source":"en", "target":"fr", "count":"3", "seed":"Apple"}
response = requests.get(inference_url, params=params)
print(response.json())

JavaScript

/*
Get three recommendations of articles to translate to French based on the English Wikipedia Apple article.
*/

let params = {"source":"en", "target":"fr", "count":"3", "seed":"Apple"};
const inferenceUrl = new URL('https://api.wikimedia.org/service/lw/recommendation/api/v1/translation');
inferenceUrl.search = new URLSearchParams(params);

fetch(inferenceUrl)
.then(response => response.json())
.then(data => console.log(data))

GET Parameters

source

required

source wiki language code (e.g. `en`)
target

required

target wiki language code (e.g. `fr`)
count

optional

number of recommendations to fetch (default `12`)
seed

optional

seed article for personalized recommendations. Can be a list of seeds separated by `|`
topic

optional

article topic for personalized recommendations. Can be a list of topics separated by `|`
include_pageviews

optional

whether to include pageview counts in the response (e.g `true`, `false`. default `false`)
search_algorithm

optional

which search algorithm to use (e.g `morelike`, `mostpopular`. default `morelike`)
rank_method

optional

which rank method to use (e.g `default`, `sitelinks`. default `default`)

Responses

200 Success: Returns an content translation recommendation object.
Example
[
  {
    "title": "Flamenco (apple)",
    "pageviews": 0,
    "wikidata_id": "Q19597233",
    "rank": 7,
    "langlinks_count": 1
  },
  {
    "title": "Applecrab",
    "pageviews": 0,
    "wikidata_id": "Q19595924",
    "rank": 8,
    "langlinks_count": 0
  },
  {
    "title": "Malus × zumi",
    "pageviews": 0,
    "wikidata_id": "Q5990804",
    "rank": 21,
    "langlinks_count": 3
  }
]