Lift Wing API/Reference/Get revscoring articlequality prediction
POST | /service/lw/inference/v1/models/{wiki}-articlequality:predict
|
---|
Get a score from the Revscoring Article Quality model (previously hosted on ORES) for a given Wiki revision id.
Note: For historical reasons, the articlequality model that is used for wikidata items uses a different URL scheme (item
instead of article
), thus the URI for wikidata is /service/lw/inference/v1/models/wikidatawiki-itemquality:predict
.
Examples
curl
Anonymous access
# Get a score from the Revscoring Article Quality model for the revision 12345 of English Wikipedia.
$ curl https://api.wikimedia.org/service/lw/inference/v1/models/enwiki-articlequality:predict -X POST -d '{"rev_id": 12345}' -H "Content-type: application/json"
Logged in access
# Get a score from the Revscoring Article Quality model for the revision 12345 of English Wikipedia.
$ curl https://api.wikimedia.org/service/lw/inference/v1/models/enwiki-articlequality:predict -X POST -d '{"rev_id": 12345}' -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-type: application/json"
Python
# Python 3
# Get a score from the Revscoring Article Quality model for the revision 12345 of English Wikipedia.
import json
import requests
use_auth = False
inference_url = 'https://api.wikimedia.org/service/lw/inference/v1/models/enwiki-articlequality:predict'
if use_auth:
headers = {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'User-Agent': 'YOUR_APP_NAME (YOUR_EMAIL_OR_CONTACT_PAGE)',
'Content-type': 'application/json'
}
else:
headers = {}
data = {"rev_id": 12345 }
response = requests.post(inference_url, headers=headers, data=json.dumps(data))
print(response.json())
JavaScript
/*
Get a score from the Revscoring Article Quality model for the revision 12345 of English Wikipedia.
*/
const inferenceUrl = "https://api.wikimedia.org/service/lw/inference/v1/models/enwiki-articlequality:predict";
const accessToken = "YOUR_ACCESS_TOKEN";
const appName = "YOUR_APP_NAME";
const email = "YOUR_EMAIL_OR_CONTACT_PAGE";
let headers = new Headers({
"Content-Type": "application/json",
"Authorization": "Bearer " + accessToken,
"Api-User-Agent": appName + " ( " + email + " )"
});
let data = {"rev_id": 12345 };
fetch(inferenceUrl, {
method: "POST",
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(inferenceData => console.log(inferenceData));
URI Parameters
wiki
required |
Wiki code:enwiki (English), euwiki (Basque), fawiki (Persian), frwiki (French), glwiki (Galician), nlwiki (Dutch), ptwiki (Portoguese), ruwiki (Russian), svwiki (Swedish), trwiki (Turkish), ukwiki (Ukrainian) or wikidatawiki (Wikidata, see note above).
|
POST Parameters
rev_id
required |
Wiki Revision id: integer related to a certain revision id for the Wiki set in the URI parameter. |
extended_output
|
Whether or not the response should include the extended output of the model (like the list of features used etc..). Either true or false. Default: false |
Responses
200 | Success: Revision id found. Returns a Revscoring score object.
Example
{
"enwiki": {
"models": {
"articlequality": {
"version": "0.8.2"
}
},
"scores": {
"12345": {
"articlequality": {
"score": {
"prediction": "Stub",
"probability": {
"B": 0.0485969161578697,
"C": 0.028513124194213476,
"FA": 0.0030320049715483475,
"GA": 0.005008907686741135,
"Start": 0.11763969051576227,
"Stub": 0.7972093564738649
}
}
}
}
}
}
}
|
---|