Package: revscoring
Revision ScoringA generic, machine learning-based revision scoring system designed to help automate critical wiki-work — for example, vandalism detection and removal. This library powersORES.ExampleUsing a scorer_model to score a revision::importmwapifromrevscoringimportModelfromrevscoring.extractors.api.extractorimportExtractorwithopen("models/enwiki.damaging.linear_svc.model")asf:scorer_model=Model.load(f)extractor=Extractor(mwapi.Session(host="https://en.wikipedia.org",user_agent="revscoring demo"))feature_values=list(extractor.extract(123456789,scorer_model.features))print(scorer_model.score(feature_values)){'prediction':True,'probability':{False:0.4694409344514984,True:0.5305590655485017}}InstallationThe easiest way to install is via the Python package installer
(pip).pip install revscoringYou may find that some of the dependencies fail to compile (namelyscipy,numpyandsklearn).  In that case, you'll need to install some
dependencies in your operating system.Ubuntu & Debian:Runsudo apt-get install python3-dev g++ gfortran liblapack-dev libopenblas-dev enchantRunsudo apt-get install aspell-ar aspell-bn aspell-el aspell-id aspell-is aspell-pl aspell-ro aspell-sv aspell-ta aspell-uk myspell-cs myspell-de-at myspell-de-ch myspell-de-de myspell-es myspell-et myspell-fa myspell-fr myspell-he myspell-hr myspell-hu myspell-lv myspell-nb myspell-nl myspell-pt-pt myspell-pt-br myspell-ru myspell-hr hunspell-bs hunspell-ca hunspell-en-au hunspell-en-us hunspell-en-gb hunspell-eu hunspell-gl hunspell-it hunspell-hi hunspell-sr hunspell-vi voikko-fiMacOS:Using Homebrew and pip, installingrevscoringandenchantcan be accomplished
as follows::brewinstallaspell--with-all-languages
brewinstallenchant
pipinstall--no-binarypyenchantrevscoringAdding languages in aspell (MacOS only)cd/tmp
wgethttp://ftp.gnu.org/gnu/aspell/dict/pt/aspell-pt-0.50-2.tar.bz2
bzip2-dcaspell-pt-0.50-2.tar.bz2|tarxvf-cdaspell-pt-0.50-2
./configure
make
sudomakeinstallCaveats:The differences between theaspellandmyspelldictionaries can causesome of the tests to failFinally, in order to make use of language features, you'll need to download
some NLTK data.  The following command will get the necessary corpora.python -m nltk.downloader omw sentiwordnet stopwords wordnetYou'll also need to installenchant-compatible
dictionaries of the languages you'd like to use.  We recommend the following:languages.arabic: aspell-arlanguages.basque: hunspell-eulanguages.bengali: aspell-bnlanguages.bosnian: hunspell-bslanguages.catalan: myspell-calanguages.czech: myspell-cslanguages.croatian: myspell-hrlanguages.dutch: myspell-nllanguages.english: myspell-en-us myspell-en-gb myspell-en-aulanguages.estonian: myspell-etlanguages.finnish: voikko-filanguages.french: myspell-frlanguages.galician: hunspell-gllanguages.german: myspell-de-at myspell-de-ch myspell-de-delanguages.greek: aspell-ellanguages.hebrew: myspell-helanguages.hindi: aspell-hilanguages.hungarian: myspell-hulanguages.icelandic: aspell-islanguages.indonesian: aspell-idlanguages.italian: myspell-itlanguages.latvian: myspell-lvlanguages.norwegian: myspell-nblanguages.persian: myspell-falanguages.polish: aspell-pllanguages.portuguese: myspell-pt-pt myspell-pt-brlanguages.serbian: hunspell-srlanguages.spanish: myspell-eslanguages.swedish: aspell-svlanguages.tamil: aspell-talanguages.russian: myspell-rulanguages.ukrainian: aspell-uklanguages.vietnamese: hunspell-viDevelopmentTo contribute, ensure to install the dependencies:$pipinstall-rrequirements.txtInstall necessary NLTK data:python -m nltk.downloader omw sentiwordnet stopwords wordnetRunning testsMake sure you install test dependencies:$pipinstall-rtest-requirements.txtThen run:$pytest.-vvReporting bugsTo report a bug, please usePhabricatorAuthorsAaron HalfakerHelderAdam Roses WightAmir Sarabadani