Skip to content

Instantly share code, notes, and snippets.

Avatar

Amir Sarabadani Ladsgroup

View GitHub Profile
@Ladsgroup
Ladsgroup / pickle rick.py
Created Jul 29, 2020
features based on kmeans clustering of properties
View pickle rick.py
from revscoring import Feature
from revscoring.datasources import \
revision_oriented as revision_oriented_datasources
from revscoring.datasources.datasource import Datasource
from revscoring.features import wikibase as wikibase_
from revscoring.features import modifiers
from revscoring.features.feature_vector import FeatureVector
from revscoring.features.meta import aggregators, bools
from revscoring.features.modifiers import not_
@Ladsgroup
Ladsgroup / deleter.py
Created Jun 27, 2020
Deleting non notable items.
View deleter.py
# Liecense: MIT
import pywikibot
import re
import sys
wikidata = pywikibot.Site('wikidata', 'wikidata')
wikidata.login()
repo = wikidata.data_repository()
report_page = pywikibot.Page(wikidata, 'User:Pasleim/Items for deletion/Page deleted')
for qid in re.findall(r'\{\{Q\|Q?(\d+)\}\}\s*\(.+?\)\s*\|\|\s*0\s*\|\|\s*0\s*\|\|\s*0\s*\|\|', report_page.get()):
item = pywikibot.ItemPage(repo, 'Q' + qid)
View rl_modules.json
["wikibase.experts.Sense", "wikibase.serialization", "wikibase.serialization.SnakListDeserializer", "wikibase.getUserLanguages", "jquery.valueview.experts.MonolingualText", "wikibase.datamodel.SiteLinkSet", "lexeme-header", "jquery.wikibase.entityview", "jquery.wikibase.entityselector", "jquery.ui.unitsuggester", "wikibase.datamodel", "wikibase.lexeme.serialization.LexemeDeserializer", "wikibase.serialization.Deserializer", "wikibase.dataTypes.DataTypeStore", "jquery.valueview.experts.TimeInput", "wikibase.sites", "wikibase.serialization.MultiTermMapDeserializer", "wikibase.lexeme", "wikibase.lexeme.store", "wikibase.client.getMwApiForRepo", "jquery.valueview.experts.QuantityInput", "wikibase.termbox", "wikibase.lexeme.special", "mw.config.values.wbRepo", "wikibase.serialization.MultiTermDeserializer", "wikibase.datamodel.Statement", "wikibase.lexeme.datamodel.Form", "wikibase.mobile", "wikibase.serialization.TermSerializer", "valueParsers.ValueParserStore", "jquery.valueview.ExpertExtender.UnitSelector", "jq
View ejemplo.py
class WbQuantity(object):
def __init__(self, serializaiton):
self.amount = serializaiton['amount']
def __eq__(self, other):
if isintance(other, str):
return self.amount == other
return self == other
View external_idefs.json
["P638", "P639", "P640", "P646", "P648", "P649", "P650", "P651", "P652", "P653", "P657", "P661", "P662", "P663", "P665", "P668", "P671", "P672", "P673", "P675", "P677", "P679", "P683", "P685", "P686", "P687", "P691", "P695", "P696", "P698", "P699", "P700", "P701", "P704", "P705", "P709", "P714", "P715", "P716", "P717", "P718", "P721", "P722", "P723", "P724", "P727", "P731", "P732", "P733", "P745", "P757", "P758", "P759", "P760", "P761", "P762", "P763", "P764", "P771", "P772", "P773", "P774", "P775", "P776", "P777", "P778", "P779", "P781", "P782", "P804", "P806", "P808", "P809", "P815", "P818", "P819", "P821", "P824", "P827", "P829", "P830", "P836", "P838", "P839", "P842", "P843", "P844", "P845", "P846", "P849", "P850", "P858", "P860", "P861", "P862", "P863", "P864", "P865", "P866", "P867", "P212", "P213", "P214", "P218", "P219", "P220", "P221", "P227", "P231", "P232", "P234", "P235", "P236", "P243", "P244", "P245", "P247", "P267", "P268", "P269", "P270", "P271", "P278", "P297", "P298", "P299", "P300", "P303",
View anlyzor.py
import os
from w3lib.html import get_base_url
from collections import defaultdict, OrderedDict
import requests
import extruct
import pprint
import sys
from wikidatarefisland.external_identifier import ExternalIdentifier
View non_exisiting_schemaorg_properties.json
{"headline": 721, "dateModified": 395, "mainEntityOfPage": 385, "additionalType": 300, "description": 96, "title": 67, "itemListElement": 59, "jobTitle": 43, "address": 40, "aggregateRating": 29, "applicationCategory": 20, "offers": 20, "alternateName": 19, "screenshot": 18, "events": 17, "photo": 16, "thumbnailUrl": 14, "keywords": 12, "artworkSurface": 10, "artMedium": 10, "artist": 10, "mainContentOfPage": 10, "containedIn": 10, "jobtitle": 10, "breadcrumb": 10, "fileSize": 10, "fileFormat": 10, "subjectOf": 10, "isbn": 9, "review": 9, "performerIn": 9, "additionalName": 8, "relatedTo": 8, "articleBody": 7, "pageTitle": 7, "type": 7, "publicationNumber": 7, "numberWithoutCodes": 7, "kindCode": 7, "publicationDescription": 7, "countryCode": 7, "countryName": 7, "priorArtKeywords": 7, "priorArtDate": 7, "legalStatusIfi": 7, "applicationNumber": 7, "assigneeCurrent": 7, "assigneeOriginal": 7, "priorityDate": 7, "filingDate": 7, "publicationDate": 7, "links": 7, "cpcs": 7, "application": 7, "family": 7, "forwa
View final_res.json
{"good_items_with_ex_idef": 3703045, "total_unref": 119703291, "done_up_to": "Q87469000", "total_total": 202513067, "detailed_stats": {"P345": 691913, "P1006": 390318, "P1216": 380261, "P7859": 342128, "P2163": 307992, "P434": 205058, "P436": 170743, "P3186": 162899, "P950": 156054, "P1953": 149446, "P1447": 130303, "P3138": 122957, "P2013": 115571, "P1954": 115093, "P2949": 111093, "P243": 93634, "P2600": 89820, "P535": 85769, "P1258": 83724, "P650": 82984, "P724": 79641, "P480": 78477, "P3762": 68658, "P3478": 65001, "P1415": 60807, "P2435": 60480, "P6127": 60431, "P236": 59267, "P3782": 58360, "P380": 58255, "P1053": 57678, "P5032": 56489, "P3829": 52892, "P2843": 48994, "P2427": 47133, "P2638": 44448, "P2924": 43436, "P2574": 42252, "P1047": 41241, "P905": 41124, "P5786": 39147, "P5361": 35750, "P481": 35354, "P6671": 35129, "P2346": 33830, "P3537": 32716, "P6689": 31406, "P435": 31145, "P2631": 30926, "P4342": 30080, "P1644": 29615, "P2456": 28177, "P4947": 27879, "P4762": 27656, "P2626": 27297, "P2397":
View phpunit4_killer.py
# License: MIT
# Run like: "python phpunit4_killer.py /var/lib/mediawiki/extensions/Wikibase/"
import os
import sys
import re
import subprocess
def find_files(path):
files = []
for r, d, f in os.walk(path):
@Ladsgroup
Ladsgroup / cleaner.js
Last active Jul 30, 2019
Commons cleaner
View cleaner.js
# License: CC-0
var api = new mw.Api();
function block() {
var params = {
action:'query',
prop: 'imageinfo',
generator: 'search',
gsrsearch: 'incaption:"no caption, no cc-zero"',
gsrnamespace: 6,
gsrlimit: 50
You can’t perform that action at this time.