Last active
December 12, 2015 17:50
-
-
Save halfak/1620beae124716504cba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python 3.4.3 (default, Jul 28 2015, 18:20:59) | |
[GCC 4.8.4] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from revscoring.datasources import revision | |
>>> from revscoring.extractors import APIExtractor | |
>>> import mwapi | |
>>> extractor = APIExtractor(mwapi.Session("https://en.wikipedia.org")) | |
Sending requests with default User-Agent. Set 'user_agent' on mwapi.Session to quiet this message. | |
>>> extractor.extract(637398301, revision.tokens)[:10] | |
[Token('{{', type='dcurly_open'), | |
Token('bots', type='word'), | |
Token('|', type='etc'), | |
Token('deny', type='word'), | |
Token('=', type='equals'), | |
Token('DPL', type='word'), | |
Token(' ', type='whitespace'), | |
Token('bot', type='word'), | |
Token('}}', type='dcurly_close'), | |
Token('\n', type='whitespace')] | |
>>> extractor.extract(686575075, revision.content_tokens)[:10] | |
[Token('135', type='number'), | |
Token('px140px135px140px', type='word'), | |
Token(' ', type='whitespace'), | |
Token('Biology', type='word'), | |
Token(' ', type='whitespace'), | |
Token('deals', type='word'), | |
Token(' ', type='whitespace'), | |
Token('with', type='word'), | |
Token(' ', type='whitespace'), | |
Token('the', type='word')] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment