Comparing WikiVectors and CirrusSearch Morelike for RelatedPages

This notebook generates a set of mock Wikipedia articles with RelatedPages recommendations at the bottom, mimicing the layout of the RelatedPages feature currently enabled on mobile web and apps—with one crucual difference: each page presents two sets of recommendations, one set is generated from CirrusSearch Morelike (currently deployed model), and the other is generated from the WikiVectors model.

These pages will be shown to potential Wikipedia readers, who will be asked to evaluate which set of recommendations they prefer, across several metrics. The goal is to ascertain which model generates better recommendations, from the perspective of Wikipedia readers.

import json
from operator import itemgetter
import pickle
from pprint import pprint
import requests
from random import choice, seed
from urllib import parse
import time
def api_call(endpoint, parameters):
    try:
        call = requests.get(endpoint, params=parameters)
        response = call.json()
    except:
        response = None
    return response

Article sample

For the first study, we will be using a set of articles used in previous comparisons of different Morelike models.

S_ENDPOINT = 'https://mediawiki.org/w/api.php'

s_params = {'action' : 'mobileview',
            'prop' : 'sections',
            'page' : 'Extension:RelatedArticles/CirrusSearchComparison',
            'format' : 'json',
            }

s_response = api_call(S_ENDPOINT, s_params)

if s_response:
    article_list = [parse.unquote(x['line'].replace("_"," ")) for x in s_response['mobileview']['sections'] if ('line' in x.keys() and x['toclevel'] == 2)]
else:
    print("Error retrieving response from API")
pprint(article_list)
['Revolution Muslim',
 'Chesser',
 'List of serial killers before 1900',
 'Murder of Kelly Anne Bates',
 'Korur language',
 'Sarah Mason (novelist)',
 "Murke's Collected Silences",
 'Gabriels, New York',
 'Isabel Fonseca',
 'Andrew Michael Hurley',
 'The Queen of the Tearling',
 'Did You Ever Have a Family',
 "Tell The Wolves I'm Home",
 'Cathy Marie Buchanan',
 'John Michael Cummings',
 'Blood Ties (Hinton novel)',
 'Jack (Homes novel)',
 'Opernpassage',
 'Yazoo and Mississippi Valley Railroad',
 'Aimé Ngoy Mukena',
 'Francis Patrick Donovan',
 'Thomas Meehan (writer)',
 'Michael E. Smith',
 'James Morrill',
 'Will Self',
 'Kiss',
 'Amanda Green',
 'Uttar Pradesh',
 'United States Senate elections, 1922',
 'A Summer Bird-Cage',
 'Don Perata',
 'Rashod Moulton',
 'Nicole Moudaber',
 'Isocitrate/isopropylmalate dehydrogenase family',
 'Gary Rowett',
 'Hollywood Library',
 'Hartford railway station',
 'Sir Elwoodin hiljaiset värit',
 'Baamba',
 '2016 Los Angeles Kiss season',
 '2006 Latvian First League']

Article section headings

Level 1 only

#get the section headings for the source article and create a dict for them
SH_ENDPOINT = 'https://en.wikipedia.org/w/api.php'

sh_params = {'action' : 'mobileview',
            'prop' : 'sections',
            'format' : 'json',
            }

redirects = {} #will remove all redirects for now, later will swap out their titles for the redirected one

section_headings = {}

for a in article_list:
    sh_params['page'] = a
#     print(k)
    sh_response = api_call(SH_ENDPOINT, sh_params)
#     print(sh_response)
    section_headings[a] = [parse.unquote(x['line'].replace("_"," ")) for x in sh_response['mobileview']['sections'] if ('line' in x.keys() and x['toclevel'] == 1)]
    if 'redirected' in sh_response['mobileview'].keys():
#         articles[k]['redirected'] = sh_response['mobileview']['redirected'] #not working. adds to all articles
        print(a + " redirects to " + sh_response['mobileview']['redirected'])
        redirects[a] = sh_response['mobileview']['redirected']
#     else:
    #     articles[k]['sections'] = [parse.unquote(x['line'].replace("_"," ")) for x in sh_response['mobileview']['sections'] if ('line' in x.keys() and x['toclevel'] == 1)]
#     print(articles[k]['sections'])
#     print(articles[k])
# articles = {k:v for k,v in articles.items() if k not in redirects} #remove redirects, 

# print(articles)
Korur language redirects to Anus language
United States Senate elections, 1922 redirects to United States Senate elections, 1922 and 1923
pprint(redirects)
{'Korur language': 'Anus language',
 'United States Senate elections, 1922': 'United States Senate elections, '
                                         '1922 and 1923'}
#swap out the redirects
for k,v in redirects.items():
    if k in section_headings.keys():
        section_headings[v] = section_headings.pop(k)

for i, a in enumerate(article_list):
    if a in redirects.keys():
        article_list[i] = redirects[a]
pprint(section_headings)
{'2006 Latvian First League': ['Overview',
                               'League standings',
                               'Top-scorers',
                               'References'],
 '2016 Los Angeles Kiss season': ['Standings',
                                  'Schedule',
                                  'Roster',
                                  'References'],
 'A Summer Bird-Cage': ['Content', 'References'],
 'Aimé Ngoy Mukena': ['Early life and education',
                      'Career',
                      'Published work',
                      'References'],
 'Amanda Green': ['Early life',
                  'Career',
                  'Personal life',
                  'See also',
                  'References',
                  'External links'],
 'Andrew Michael Hurley': ['References', 'External links'],
 'Anus language': ['References', 'External links'],
 'Baamba': [],
 'Blood Ties (Hinton novel)': ['Format', 'Plot', 'References'],
 'Cathy Marie Buchanan': ['References', 'External links'],
 'Chesser': ['Sources'],
 'Did You Ever Have a Family': ['Plot summary',
                                'Characters',
                                'Reception',
                                'Recognition',
                                'References'],
 'Don Perata': ['Background',
                'Alameda County politics',
                'Rise to the California State Senate',
                'California State Senate',
                'Post-Senate',
                'Political controversy',
                'References',
                'External links',
                'Offices held'],
 'Francis Patrick Donovan': ['Early life',
                             'Educational career',
                             'Diplomatic career',
                             'Later life and death',
                             'Awards and decorations',
                             'References'],
 'Gabriels, New York': ['References'],
 'Gary Rowett': ['Playing career',
                 'Management career',
                 'Media career',
                 'Managerial statistics',
                 'References',
                 'External links'],
 'Hartford railway station': ['History',
                              'Facilities',
                              'Services',
                              'References',
                              'External links'],
 'Hollywood Library': ['History', 'See also', 'References', 'External links'],
 'Isabel Fonseca': ['References', 'External links'],
 'Isocitrate/isopropylmalate dehydrogenase family': ['References'],
 'Jack (Homes novel)': ['Plot',
                        'Characters',
                        'Reception',
                        'Adaptation',
                        'References',
                        'External links'],
 'James Morrill': ['References'],
 'John Michael Cummings': ['Works', 'References', 'External links'],
 'Kiss': ['History',
          'Types',
          'Kiss as ritual',
          'Cultural significance',
          'Contemporary practices',
          'Legality',
          'In religion',
          'Biology and evolution',
          'See also',
          'References',
          'Further reading',
          'External links'],
 'List of serial killers before 1900': ['Active before 1600',
                                        '1600 to 1800',
                                        '1801 to 1830',
                                        '1831 to 1850',
                                        '1851 to 1880',
                                        'After 1881',
                                        'Legendary serial killers',
                                        'See also',
                                        'References'],
 'Michael E. Smith': ['Published works', 'Notes', 'External links'],
 'Murder of Kelly Anne Bates': ['Background',
                                'Murder',
                                'Trial',
                                'In the media',
                                'See also',
                                'References'],
 "Murke's Collected Silences": ['Synopsis',
                                'See also',
                                'Notes',
                                'Further reading'],
 'Nicole Moudaber': ['Biography',
                     'Discography',
                     'Awards and nominations',
                     'Interviews',
                     'References',
                     'External links'],
 'Opernpassage': ['References'],
 'Rashod Moulton': ['External links'],
 'Revolution Muslim': ['History',
                       'Analysis',
                       'Times Square car bomb',
                       'Former members',
                       'References',
                       'External links'],
 'Sarah Mason (novelist)': ['Biography',
                            'Bibliography',
                            'References and sources'],
 'Sir Elwoodin hiljaiset värit': ['Members', 'Discography', 'External links'],
 "Tell The Wolves I'm Home": ['Plot', 'Writing', 'Reception', 'References'],
 'The Queen of the Tearling': ['Plot',
                               'Reaction',
                               'Film adaptation',
                               'References',
                               'External links'],
 'Thomas Meehan (writer)': ['Life and career', 'References', 'External links'],
 'United States Senate elections, 1922 and 1923': ['Change in Senate '
                                                   'composition',
                                                   'Gains and losses',
                                                   'Race summaries',
                                                   'See also',
                                                   'References'],
 'Uttar Pradesh': ['History',
                   'Geography',
                   'Flora and Fauna',
                   'Divisions, districts and cities',
                   'Demographics',
                   'Government and politics',
                   'Crime',
                   'Economy',
                   'Transportation',
                   'Sports',
                   'Education',
                   'Tourism',
                   'Culture',
                   'Media',
                   'See also',
                   'References',
                   'External links'],
 'Will Self': ['Early life',
               'Career',
               'Literary style',
               'Personal life',
               'Awards',
               'Works',
               'References',
               'External links'],
 'Yazoo and Mississippi Valley Railroad': ['Blues music',
                                           'See also',
                                           'References',
                                           'External links']}
print(len(section_headings))
41

Article lead text and lead image

#get the lead text from the source article and add it to a dict
#could pass multiple titles per API call, only doing one at a time for now
LT_ENDPOINT = 'https://en.wikipedia.org/w/api.php'

lt_params = {'action' : 'query',
            'prop' : 'extracts',
            'format' : 'json',
            'exsentences' : 5,
            'exintro' : '',
            'explaintext' : '',            
            }

lead_text = {}

for a in article_list:
    lt_params['titles'] = a
    lt_response = api_call(LT_ENDPOINT, lt_params)
    for v in lt_response['query']['pages'].values():
        lead_text[a] = v['extract']
pprint(lead_text)
{'2006 Latvian First League': 'These are the statistics of the Latvian First '
                              'League during the 2006 season.',
 '2016 Los Angeles Kiss season': 'The 2016 Los Angeles Kiss season was the '
                                 'third and final season for the arena '
                                 'football franchise in the Arena Football '
                                 'League. The team was coached by Omarr '
                                 'Smith and played their home games at Honda '
                                 'Center.',
 'A Summer Bird-Cage': 'A Summer Bird-Cage is the 1963 debut novel by '
                       'Margaret Drabble published by Weidenfeld & Nicolson.',
 'Aimé Ngoy Mukena': 'Aimé Ngoy Mukena is a political figure from the '
                     'Democratic Republic of the Congo who has served as '
                     'Minister of Petroleum and Gas since 26 September 2015. '
                     'He previously served as Minister of Defence and '
                     "Veterans' Affairs  under President Joseph Kabila. He "
                     "is a founding member of the People's Party for "
                     'Reconstruction and Democracy (PPRD), one of the most '
                     'influential political parties in the Congo where he '
                     'served as its Executive Secretary in charge of '
                     'interior and decentralization.\n'
                     'Mukena studied Political Philosophy at the University '
                     'of Lausanne. Ethic, Theology and Human Resources '
                     'Management at the University of Geneva, and African '
                     'Linguistics at ISP Lubumbashi.',
 'Amanda Green': 'Amanda Green (born December 29, 1963) is an American '
                 'actress, singer and songwriter.',
 'Andrew Michael Hurley': 'Andrew Michael Hurley (born 1975) is a British '
                          'writer whose debut novel, The Loney, was '
                          'published in a limited edition of 300 copies in '
                          '2014 by Tartarus Press and was published under '
                          "Hodder and Stoughton's John Murray imprint in "
                          '2015 (ISBN 9781473619821). He was interviewed on '
                          'BBC Radio 4\'s Open Book programme "British '
                          'Gothic" in October 2015.\n'
                          'The Loney has been reviewed in The Guardian and '
                          'The Telegraph. It is set in the area of Morecambe '
                          'Bay in north west England, described in the text '
                          'as "that strange nowhere between the Wyre and the '
                          'Lune". Hurley has said that the novel\'s two '
                          'starting points were "to write a kind of dark '
                          'version of the Nativity [...] and exploring ideas '
                          'of faith and belief" and "various wild, lonely '
                          'places on the north west coast of Lancashire '
                          '[...] a sense of imminent menace or dormant power '
                          'lying just under the sand and the water".',
 'Anus language': 'Anus, or Korur, is an Austronesian language spoken on an '
                  'island in Jayapura Bay east of the Tor River in Papua '
                  'province of Indonesia. It is one of the Sarmi languages.',
 'Baamba': 'Baamba may refer to:',
 'Blood Ties (Hinton novel)': 'Blood Ties is a novel by British author Nigel '
                              'Hinton. It was first published in 2000 and '
                              'follows the story of two families on holiday '
                              'whose parents go dangerously insane. '
                              'According to the author he wrote it for '
                              'people learning English.',
 'Cathy Marie Buchanan': 'Cathy Marie Buchanan is a Toronto-based writer. '
                         'The Day the Falls Stood Still, her debut novel, '
                         'was published in North America in 2009 and Italy '
                         'and the UK in 2010. It immediately became a New '
                         'York Times bestseller. The novel was chosen as a '
                         'Barnes & Noble Recommends selection, a Barnes & '
                         'Noble Best of 2009 book, an American Booksellers '
                         'Association Indie Next pick and a CBC Canada Reads '
                         'Top 40 Essential Canadian Novel of the Decade. '
                         "Inspired by the life of Niagara's most famous "
                         'riverman, William "Red" Hill, the novel chronicles '
                         'early hydroelectric development on the Niagara '
                         'River.',
 'Chesser': 'Chesser is a mainly residential suburb of Edinburgh, Scotland, '
            'south of the Water of Leith. It is situated with Longstone and '
            'Slateford to the west, Allan Park and Craiglockhart to the '
            'south, Hutchison and Moat to the east and Gorgie Road to the '
            'north.\n'
            'The Edinburgh Corn Exchange is situated in Chesser, providing a '
            'venue for regular live events. Recent regeneration has seen the '
            'existing, predominantly early 20th century housing stock '
            'supplemented with modern developments. Sporting and shopping '
            'facilities are also in the area including an Asda supermarket.',
 'Did You Ever Have a Family': 'Did You Ever Have a Family is the debut '
                               'novel by American literary agent and author '
                               'Bill Clegg, published in 2015.',
 'Don Perata': 'Don Richard Perata (born April 30, 1945) is a California '
               'Democratic politician, who was President pro tempore of the '
               'California State Senate from 2004 to 2008. He came in second '
               'place in the November 2010 ballot for Mayor of Oakland.',
 'Francis Patrick Donovan': 'Francis Patrick Donovan, AM (1 February 1922 − '
                            '3 February 2012) was Australian Ambassador and '
                            'Permanent Representative to the OECD, and '
                            'Ambassador and Special Trade Delegate to the '
                            'United Nations Office at Geneva. After '
                            'retirement from the Diplomatic Service, he '
                            'became a Vice-Chairman of the International '
                            'Court of Arbitration.',
 'Gabriels, New York': 'Gabriels is a hamlet in the town of Brighton in '
                       'Franklin County, New York, inside the Adirondack '
                       'Park near Paul Smiths. The village developed around '
                       'a tuberculosis cure facility, the Gabriels '
                       'Sanatorium, which was opened in 1897 by the Catholic '
                       'Sisters of Mercy. The land was donated by Paul Smith '
                       'and W. Seward Webb. The site was later purchased by '
                       "Paul Smith's College. The site was sold to the "
                       'Department of Corrections in 1982.',
 'Gary Rowett': 'Gary Rowett (born 6 March 1974) is an English professional '
                'football manager and former player. He was appointed '
                'manager of Birmingham City in October 2014 and served until '
                'December 2016.\n'
                'As a player he was a defender, and played in the Premier '
                'League for Everton, Derby County, Leicester City and '
                'Charlton Athletic. He also played in the Football League '
                'for Cambridge United, Blackpool, Birmingham City and Burton '
                'Albion. In May 2009 he was appointed assistant manager to '
                'Paul Peschisolido at Burton, and took over as manager in '
                '2012.',
 'Hartford railway station': 'Hartford railway station is in the village of '
                             'Hartford, in Cheshire, England. It is situated '
                             'on the A559 road approximately two miles (3.2 '
                             'km) west of the town of Northwich.',
 'Hollywood Library': 'The Hollywood Library is a branch of the Multnomah '
                      'County Library (MCL), in the Hollywood District of '
                      'Portland in the U.S. state of Oregon. The building, '
                      'at N.E. 40th Avenue and Tillamook Street, opened in '
                      '2002, and has three residential stories above the '
                      'library. The previous building, constructed in 1959 '
                      'at N.E. 39th Avenue and Hancock Street, was expected '
                      'to be sold in 2003 to a private party, for its '
                      'appraised price of $675,000. The branch offers the '
                      'MCL catalog of two million books, periodicals and '
                      'other materials.',
 'Isabel Fonseca': 'Isabel Fonseca (born 1961, New York City) is an American '
                   'writer.\n'
                   'She is the youngest of Uruguayan sculptor Gonzalo '
                   "Fonseca's four children, and the sister of the painters "
                   'Caio Fonseca and Bruno Fonseca (1958–1994).\n'
                   'She attended Concord Academy and graduated magna cum '
                   'laude from Barnard College in 1984. She then studied at '
                   'Wadham College, Oxford and worked in publishing and '
                   'newspapers in London, notably at the Times Literary '
                   'Supplement.\n'
                   'She is the author of the bestselling Bury Me Standing: '
                   'The Gypsies and Their Journey (1995), a non-fiction book '
                   'about the lives of Romani people.',
 'Isocitrate/isopropylmalate dehydrogenase family': 'In molecular biology, '
                                                    'the '
                                                    'isocitrate/isopropylmalate '
                                                    'dehydrogenase family is '
                                                    'a protein family '
                                                    'consisting of the '
                                                    'evolutionary related '
                                                    'enzymes isocitrate '
                                                    'dehydrogenase, '
                                                    '3-isopropylmalate '
                                                    'dehydrogenase and '
                                                    'tartrate '
                                                    'dehydrogenase.\n'
                                                    'Isocitrate '
                                                    'dehydrogenase (IDH), is '
                                                    'an important enzyme of '
                                                    'carbohydrate metabolism '
                                                    'which catalyses the '
                                                    'oxidative '
                                                    'decarboxylation of '
                                                    'isocitrate into '
                                                    'alpha-ketoglutarate. '
                                                    'IDH is either dependent '
                                                    'on NAD+ EC 1.1.1.41 or '
                                                    'on NADP+ EC 1.1.1.42. '
                                                    'In eukaryotes there are '
                                                    'at least three isozymes '
                                                    'of IDH: two are located '
                                                    'in the mitochondrial '
                                                    'matrix (one '
                                                    'NAD+-dependent, the '
                                                    'other NADP+-dependent), '
                                                    'while the third one '
                                                    '(also NADP+-dependent) '
                                                    'is cytoplasmic. In '
                                                    'Escherichia coli the '
                                                    'activity of a '
                                                    'NADP+-dependent form of '
                                                    'the enzyme is '
                                                    'controlled by the '
                                                    'phosphorylation of a '
                                                    'serine residue; the '
                                                    'phosphorylated form of '
                                                    'IDH is completely '
                                                    'inactivated.',
 'Jack (Homes novel)': 'Jack is the 1990 debut novel by American writer A. '
                       'M. Homes, published when she was 19. She wrote the '
                       'novel while attending Sarah Lawrence College. It is '
                       'a bildungsroman or coming-of-age novel, dealing with '
                       "a 15-year-old boy's grappling with issues of divorce "
                       'and sexuality in his family and among his friends.',
 'James Morrill': 'James Lewis Morrill (September 24, 1891 – July 1979) was '
                  'a professor and academic administrator who served as the '
                  'president of the University of Wyoming and the University '
                  'of Minnesota. He attended The Ohio State University for '
                  'his undergraduate education and, after a brief career as '
                  'a journalist, he returned there for a career in teaching '
                  'and administration. In 1942 he left to accept the '
                  'position of president at the University of Wyoming. After '
                  'only three years he was recruited to become the eighth '
                  'president of the University of Minnesota. During his time '
                  'at the University of Minnesota he oversaw a period of '
                  'immense growth; enrollment at the school more than '
                  'doubled in a single year due in large part to returning '
                  'servicemen using the G.I. Bill to pursue a college '
                  'education.',
 'John Michael Cummings': 'John Michael Cummings (born 1963 in Harpers '
                          'Ferry, West Virginia) is an American novelist and '
                          'short story writer. His novels include The Night '
                          'I Freed John Brown (Penguin Group, 2008), winner '
                          'of the Paterson Prize for Books for Young '
                          'People;Ugly To Start With (West Virginia '
                          'University Press, 2011), IndieFab Award Finalist; '
                          "and Don't Forget Me, Bro (Stephen F. Austin State "
                          "University Press, 2015). Don't Forget Me, Bro has "
                          'been excerpted in The Chicago Tribune.\n'
                          "Cummings' short stories and essays have appeared "
                          'in more than seventy-five literary journals, '
                          'including North American Review, Alaska Quarterly '
                          'Review, The Chattahoochee Review, The Kenyon '
                          'Review, and The Iowa Review. His short fiction '
                          'has been nominated twice for the Pushcart Prize.',
 'Kiss': "A kiss is the touch or pressing of one's lips against another "
         'person or an object. Cultural connotations of kissing vary widely. '
         'Depending on the culture and context, a kiss can express '
         'sentiments of love, passion, romance, sexual attraction, sexual '
         'activity, sexual arousal, affection, respect, greeting, '
         'friendship, peace and good luck, among many others. In some '
         'situations a kiss is a ritual, formal or symbolic gesture '
         'indicating devotion, respect, or sacrament. The word came from Old '
         'English cyssan (“to kiss”), in turn from coss (“a kiss”).',
 'List of serial killers before 1900': 'The following is a list of known '
                                       'serial killers active before 1900, '
                                       'in roughly chronological order.',
 'Michael E. Smith': 'Michael Ernest Smith (born 1953) is an American '
                     'archaeologist working primarily with Aztec and general '
                     'Mesoamerican archaeology. He has written numerous '
                     'scholarly articles about central Mexican archaeology '
                     'as well as several books about the Aztecs, among them '
                     'a widely used textbook (Smith 2003). He is currently '
                     'Professor of Anthropology in the School of Human '
                     'Evolution and Social Change at Arizona State '
                     'University. He is known for stressing the importance '
                     'of assessing archaeological evidence independently of '
                     'the ethnohistorical sources, and advocating its use as '
                     'a source of knowledge about the Aztecs.',
 'Murder of Kelly Anne Bates': 'Kelly Anne Bates (18 May 1978 – 16 April '
                               '1996) was a British teenager who was '
                               'murdered in Manchester on 16 April 1996 when '
                               'aged 17. She was tortured over a period of '
                               'four weeks, including having her eyes gouged '
                               'from their sockets up to three weeks before '
                               'her death, by her partner James Patterson '
                               'Smith (born c.\u20091948) before being '
                               'drowned in a bathtub.\n'
                               'The murder inquiry was headed by Detective '
                               'Sergeant Joseph Monaghan of Greater '
                               'Manchester Police, who said: "I have been in '
                               'the police force for 15 years and have never '
                               'seen a case as horrific as this." William '
                               "Lawler, the pathologist who examined Bates' "
                               'body, described her injuries as "the worst '
                               'he had seen on a murder victim". Smith, a '
                               'misogynist with a history of violence and '
                               'torture against former lovers, denied '
                               'murdering Bates but was convicted and '
                               'sentenced to life imprisonment on 19 '
                               'November 1997.',
 "Murke's Collected Silences": '"Murke\'s Collected Silences" (German: '
                               'Doktor Murkes gesammeltes Schweigen) is a '
                               'short story by German writer Heinrich Böll, '
                               'first published in the Frankfurter Hefte in '
                               '1955 and in English in 1963. The story '
                               'examines the relationship between the '
                               'generations in post-war Germany and the '
                               "country's post-war surge in religious belief.",
 'Nicole Moudaber': 'Nicole Moudaber is a Lebanese-Nigerian music producer '
                    'and DJ born in Nigeria. In 2009, Carl Cox described her '
                    'as "the most underrated DJ" to DJ Magazine, which '
                    'helped to launch her career. Her 2013 debut album '
                    'Believe was Number 1 for a month on the Beatport '
                    'techno, tech house, and deep house charts. Moudaber has '
                    'teamed up with techno notables such as Carl Cox, Adam '
                    'Beyer, etc. and she also launched MOOD Records imprint '
                    'in 2012.',
 'Opernpassage': 'The Opernpassage (opera passage) in the Inner City of '
                 'Vienna is a Grade II listed pedestrian underpass under the '
                 'ring road (Ringstraße). It was opened in 1955, a day '
                 'before the re-opening of the nearby Vienna State Opera.\n'
                 'Designed by architect Adolf Hoch it has been a symbol of a '
                 'modern spirit in architecture and urban planning. After '
                 'more than 50 years the City of Vienna undertook a complete '
                 'restoration of the structure, advised by the Federal '
                 'Office for the Protection of Monuments in Austria. The '
                 'passage was reopened on 17 September 2013.',
 'Rashod Moulton': 'Rashod Moulton (born January 1, 1981 in St. Petersburg, '
                   'Florida) is a former American football cornerback. He '
                   'was signed by the Jacksonville Jaguars as an undrafted '
                   'free agent in 2007. He played college football at the '
                   'Fort Valley State.\n'
                   'Moulton has also been a member of the Denver Broncos.',
 'Revolution Muslim': 'Revolution Muslim (RM) was an organization based in '
                      'New York City that advocated the establishment of a '
                      'traditionalist Islamic state through the removal of '
                      'the current rulers in Muslim-majority nations and an '
                      'end to what they consider "Western imperialism". It '
                      'was founded in 2007 by two American men, one of them '
                      'Jewish, who had converted to Islam.\n'
                      'They operated both on their website '
                      '"RevolutionMuslim.com" and through street preaching '
                      'and protests. They frequently protested outside the '
                      'Islamic Cultural Center of New York, a moderate '
                      'Muslim mosque.\n'
                      'The website was eventually shut down on November '
                      '2010, shortly after the arrest of one of the leaders.',
 'Sarah Mason (novelist)': 'Sarah Mason (born 19 September 1971) is a '
                           'British novelist of romance novels since 2002. '
                           'In 2003, her debut novel Playing James won the '
                           'Romantic Novel of the Year Award by the Romantic '
                           "Novelists' Association.",
 'Sir Elwoodin hiljaiset värit': 'Sir Elwoodin hiljaiset värit is a Finnish '
                                 'rock band, hailing from the Helsinki '
                                 'suburb of Kannelmäki.\n'
                                 'The band formed in 1988 when Juha Lehti '
                                 'and Juha Saaresaho got acquainted while '
                                 'working at the Myyrmäki Youth Centre. '
                                 'Including Pete Loikala, they recorded '
                                 'their first demo tapes. Despite publishing '
                                 'records and touring regularly they did not '
                                 'get a major success until they released '
                                 'the single "Viimeisellä rannalla" in 1993. '
                                 'They scored their biggest success in 1998 '
                                 'with the compilation "Varjoja, varkaita ja '
                                 'vanhoja valokuvia", selling more than '
                                 '30,000 records (in a country of only 5 '
                                 'million), earning them a gold record.',
 "Tell The Wolves I'm Home": "Tell The Wolves I'm Home is the debut novel of "
                             'American writer Carol Rifka Brunt, published '
                             'by Random House in 2012. It follows the life '
                             'of a girl whose homosexual uncle had died of '
                             'AIDS in the 1980s, and the subsequent '
                             'friendship she develops with his boyfriend.',
 'The Queen of the Tearling': 'The Queen of the Tearling is the debut novel '
                              'by Erika Johansen. It is set in the 24th '
                              'century, and is the first novel of a planned '
                              'fantasy trilogy.',
 'Thomas Meehan (writer)': 'Thomas Edward Meehan (born August 14, 1929) is '
                           'an American writer, best known for Annie, The '
                           'Producers, and Hairspray.',
 'United States Senate elections, 1922 and 1923': 'The United States Senate '
                                                  'elections of 1922 and '
                                                  '1923 was an election '
                                                  'which occurred in the '
                                                  'middle of Republican '
                                                  'President Warren G. '
                                                  "Harding's term. With the "
                                                  'Republicans divided '
                                                  'between conservative and '
                                                  'progressive factions, the '
                                                  'Democrats gained six net '
                                                  'seats from the '
                                                  'Republicans while the '
                                                  'Farmer-Labor party gained '
                                                  'one. The Republicans '
                                                  'retained their Senate '
                                                  'majority.',
 'Uttar Pradesh': 'Uttar Pradesh (/ˈʊtər prəˈdɛʃ/, Hindi : उत्तर प्रदेश '
                  'literally "Northern Province"), abbreviated as UP, is the '
                  'most populous state in the Republic of India as well as '
                  'the most populous country subdivision in the world. It '
                  'was created on 1 April 1937 as the United Provinces '
                  'during British rule, and was renamed Uttar Pradesh in '
                  '1950. Lucknow is the capital city of Uttar Pradesh. '
                  'Ghaziabad, Bulandshahr, Kanpur, Gorakhpur, Allahabad, '
                  'Raebareli, Moradabad, Bareilly, Aligarh, Sonbhadra, and '
                  'Varanasi are known for their industrial importance in the '
                  'state. On 9 November 2000, a new state, Uttarakhand, was '
                  'carved out from the Himalayan hill region of Uttar '
                  'Pradesh.',
 'Will Self': 'William Woodard Self (born 26 September 1961) is an English '
              'novelist, journalist, political commentator and television '
              'personality.\n'
              'Self is the author of ten novels, five collections of shorter '
              'fiction, three novellas, and five collections of non-fiction '
              'writing. His work has been translated into 22 languages; his '
              '2002 novel, Dorian was longlisted for the Booker Prize, and '
              'his novel Umbrella was shortlisted for the Man Booker Prize. '
              'His fiction is known for being satirical, grotesque, and '
              'fantastical, and is predominantly set within his home city of '
              'London. His subject matter often includes mental illness, '
              'illegal drugs, and psychiatry.',
 'Yazoo and Mississippi Valley Railroad': 'The Yazoo and Mississippi Valley '
                                          'Railroad (Y&MV) was incorporated '
                                          'in 1882 and was part of the '
                                          'Illinois Central Railroad system '
                                          '(IC). Construction began in '
                                          'Jackson, Mississippi, and '
                                          'continued to Yazoo City, '
                                          'Mississippi. The line was later '
                                          'expanded through the Mississippi '
                                          'Delta and on to Memphis, '
                                          'Tennessee. In 1886, the IC '
                                          'purchased the Mississippi and '
                                          'Tennessee Railroad. In 1892, the '
                                          'IC bought the Memphis to New '
                                          'Orleans line, forming the '
                                          'Louisville, New Orleans and Texas '
                                          'Railway.'}
print(len(lead_text))
41

Lead image

#could try doing all of these in a single query by piping multiple titles and using querycontinue
#could put lead text and image together, as I do with recs below
LI_ENDPOINT = 'https://en.wikipedia.org/w/api.php'

li_params = {'action' : 'query',
            'prop' : 'pageimages',
            'format' : 'json',
            'formatversion' : 2,
            }

lead_image = {}

for a in article_list:
    li_params['titles'] = a
    li_response = api_call(LI_ENDPOINT, li_params)
    for page in li_response['query']['pages']:
        if 'pageimage' in page.keys():
            lead_image[a] = page['pageimage']
        else:
            lead_image[a] = ''
pprint(lead_image)
{'2006 Latvian First League': '',
 '2016 Los Angeles Kiss season': '',
 'A Summer Bird-Cage': 'ASummerBirdCage.jpg',
 'Aimé Ngoy Mukena': '',
 'Amanda Green': '',
 'Andrew Michael Hurley': '',
 'Anus language': '',
 'Baamba': '',
 'Blood Ties (Hinton novel)': 'Blood_Ties_(Hinton_novel)_first_edition_cover.jpg',
 'Cathy Marie Buchanan': '',
 'Chesser': 'Edinburgh_map.png',
 'Did You Ever Have a Family': '',
 'Don Perata': '',
 'Francis Patrick Donovan': 'Francis_Patrick_Donovan,_Australian_Diplomat,_1977.jpg',
 'Gabriels, New York': 'New_York_Adirondack.svg',
 'Gary Rowett': 'Gary_Rowett.jpg',
 'Hartford railway station': 'Hartford_railway_station,_Cheshire_(5).JPG',
 'Hollywood Library': 'Hollywood_Library_in_Portland.jpg',
 'Isabel Fonseca': '',
 'Isocitrate/isopropylmalate dehydrogenase family': 'PDB_1cw4_EBI.jpg',
 'Jack (Homes novel)': '',
 'James Morrill': '',
 'John Michael Cummings': "John's_Photo_3.8.2008.jpg",
 'Kiss': 'William-Adolphe_Bouguereau_(1825-1905)_-_A_Little_Coaxing_(1890).jpg',
 'List of serial killers before 1900': '',
 'Michael E. Smith': '',
 'Murder of Kelly Anne Bates': 'Picture_of_Kelly_Anne_Bates.jpg',
 "Murke's Collected Silences": 'Heinrich_Boell_Vectogramm_01.JPG',
 'Nicole Moudaber': 'Nicole_Moudaber_03.jpg',
 'Opernpassage': 'Opernpassage_Panorama.jpg',
 'Rashod Moulton': '',
 'Revolution Muslim': '',
 'Sarah Mason (novelist)': '',
 'Sir Elwoodin hiljaiset värit': '',
 "Tell The Wolves I'm Home": "Tell_The_Wolves_I'm_Home_cover_page.jpg",
 'The Queen of the Tearling': 'The_Queen_of_the_Tearling_cover.jpg',
 'Thomas Meehan (writer)': '',
 'United States Senate elections, 1922 and 1923': 'Cabotlodgenationalportrait.jpg',
 'Uttar Pradesh': 'Uttar_pradesh_Collage.jpg',
 'Will Self': '13323-Will_Self_Reading_-1660-Edit.jpg',
 'Yazoo and Mississippi Valley Railroad': ''}
#combine image and lead text dicts
lead_data = [lead_image, lead_text, section_headings]
article_content = {k:[l[k] for l in lead_data] for k in lead_data[0]}
pprint(article_content)
{'2006 Latvian First League': ['',
                               'These are the statistics of the Latvian '
                               'First League during the 2006 season.',
                               ['Overview',
                                'League standings',
                                'Top-scorers',
                                'References']],
 '2016 Los Angeles Kiss season': ['',
                                  'The 2016 Los Angeles Kiss season was the '
                                  'third and final season for the arena '
                                  'football franchise in the Arena Football '
                                  'League. The team was coached by Omarr '
                                  'Smith and played their home games at '
                                  'Honda Center.',
                                  ['Standings',
                                   'Schedule',
                                   'Roster',
                                   'References']],
 'A Summer Bird-Cage': ['ASummerBirdCage.jpg',
                        'A Summer Bird-Cage is the 1963 debut novel by '
                        'Margaret Drabble published by Weidenfeld & '
                        'Nicolson.',
                        ['Content', 'References']],
 'Aimé Ngoy Mukena': ['',
                      'Aimé Ngoy Mukena is a political figure from the '
                      'Democratic Republic of the Congo who has served as '
                      'Minister of Petroleum and Gas since 26 September '
                      '2015. He previously served as Minister of Defence '
                      "and Veterans' Affairs  under President Joseph "
                      "Kabila. He is a founding member of the People's "
                      'Party for Reconstruction and Democracy (PPRD), one '
                      'of the most influential political parties in the '
                      'Congo where he served as its Executive Secretary in '
                      'charge of interior and decentralization.\n'
                      'Mukena studied Political Philosophy at the '
                      'University of Lausanne. Ethic, Theology and Human '
                      'Resources Management at the University of Geneva, '
                      'and African Linguistics at ISP Lubumbashi.',
                      ['Early life and education',
                       'Career',
                       'Published work',
                       'References']],
 'Amanda Green': ['',
                  'Amanda Green (born December 29, 1963) is an American '
                  'actress, singer and songwriter.',
                  ['Early life',
                   'Career',
                   'Personal life',
                   'See also',
                   'References',
                   'External links']],
 'Andrew Michael Hurley': ['',
                           'Andrew Michael Hurley (born 1975) is a British '
                           'writer whose debut novel, The Loney, was '
                           'published in a limited edition of 300 copies in '
                           '2014 by Tartarus Press and was published under '
                           "Hodder and Stoughton's John Murray imprint in "
                           '2015 (ISBN 9781473619821). He was interviewed '
                           'on BBC Radio 4\'s Open Book programme "British '
                           'Gothic" in October 2015.\n'
                           'The Loney has been reviewed in The Guardian and '
                           'The Telegraph. It is set in the area of '
                           'Morecambe Bay in north west England, described '
                           'in the text as "that strange nowhere between '
                           'the Wyre and the Lune". Hurley has said that '
                           'the novel\'s two starting points were "to write '
                           'a kind of dark version of the Nativity [...] '
                           'and exploring ideas of faith and belief" and '
                           '"various wild, lonely places on the north west '
                           'coast of Lancashire [...] a sense of imminent '
                           'menace or dormant power lying just under the '
                           'sand and the water".',
                           ['References', 'External links']],
 'Anus language': ['',
                   'Anus, or Korur, is an Austronesian language spoken on '
                   'an island in Jayapura Bay east of the Tor River in '
                   'Papua province of Indonesia. It is one of the Sarmi '
                   'languages.',
                   ['References', 'External links']],
 'Baamba': ['', 'Baamba may refer to:', []],
 'Blood Ties (Hinton novel)': ['Blood_Ties_(Hinton_novel)_first_edition_cover.jpg',
                               'Blood Ties is a novel by British author '
                               'Nigel Hinton. It was first published in '
                               '2000 and follows the story of two families '
                               'on holiday whose parents go dangerously '
                               'insane. According to the author he wrote it '
                               'for people learning English.',
                               ['Format', 'Plot', 'References']],
 'Cathy Marie Buchanan': ['',
                          'Cathy Marie Buchanan is a Toronto-based writer. '
                          'The Day the Falls Stood Still, her debut novel, '
                          'was published in North America in 2009 and Italy '
                          'and the UK in 2010. It immediately became a New '
                          'York Times bestseller. The novel was chosen as a '
                          'Barnes & Noble Recommends selection, a Barnes & '
                          'Noble Best of 2009 book, an American Booksellers '
                          'Association Indie Next pick and a CBC Canada '
                          'Reads Top 40 Essential Canadian Novel of the '
                          "Decade. Inspired by the life of Niagara's most "
                          'famous riverman, William "Red" Hill, the novel '
                          'chronicles early hydroelectric development on '
                          'the Niagara River.',
                          ['References', 'External links']],
 'Chesser': ['Edinburgh_map.png',
             'Chesser is a mainly residential suburb of Edinburgh, '
             'Scotland, south of the Water of Leith. It is situated with '
             'Longstone and Slateford to the west, Allan Park and '
             'Craiglockhart to the south, Hutchison and Moat to the east '
             'and Gorgie Road to the north.\n'
             'The Edinburgh Corn Exchange is situated in Chesser, providing '
             'a venue for regular live events. Recent regeneration has seen '
             'the existing, predominantly early 20th century housing stock '
             'supplemented with modern developments. Sporting and shopping '
             'facilities are also in the area including an Asda supermarket.',
             ['Sources']],
 'Did You Ever Have a Family': ['',
                                'Did You Ever Have a Family is the debut '
                                'novel by American literary agent and '
                                'author Bill Clegg, published in 2015.',
                                ['Plot summary',
                                 'Characters',
                                 'Reception',
                                 'Recognition',
                                 'References']],
 'Don Perata': ['',
                'Don Richard Perata (born April 30, 1945) is a California '
                'Democratic politician, who was President pro tempore of '
                'the California State Senate from 2004 to 2008. He came in '
                'second place in the November 2010 ballot for Mayor of '
                'Oakland.',
                ['Background',
                 'Alameda County politics',
                 'Rise to the California State Senate',
                 'California State Senate',
                 'Post-Senate',
                 'Political controversy',
                 'References',
                 'External links',
                 'Offices held']],
 'Francis Patrick Donovan': ['Francis_Patrick_Donovan,_Australian_Diplomat,_1977.jpg',
                             'Francis Patrick Donovan, AM (1 February 1922 '
                             '− 3 February 2012) was Australian Ambassador '
                             'and Permanent Representative to the OECD, and '
                             'Ambassador and Special Trade Delegate to the '
                             'United Nations Office at Geneva. After '
                             'retirement from the Diplomatic Service, he '
                             'became a Vice-Chairman of the International '
                             'Court of Arbitration.',
                             ['Early life',
                              'Educational career',
                              'Diplomatic career',
                              'Later life and death',
                              'Awards and decorations',
                              'References']],
 'Gabriels, New York': ['New_York_Adirondack.svg',
                        'Gabriels is a hamlet in the town of Brighton in '
                        'Franklin County, New York, inside the Adirondack '
                        'Park near Paul Smiths. The village developed '
                        'around a tuberculosis cure facility, the Gabriels '
                        'Sanatorium, which was opened in 1897 by the '
                        'Catholic Sisters of Mercy. The land was donated by '
                        'Paul Smith and W. Seward Webb. The site was later '
                        "purchased by Paul Smith's College. The site was "
                        'sold to the Department of Corrections in 1982.',
                        ['References']],
 'Gary Rowett': ['Gary_Rowett.jpg',
                 'Gary Rowett (born 6 March 1974) is an English '
                 'professional football manager and former player. He was '
                 'appointed manager of Birmingham City in October 2014 and '
                 'served until December 2016.\n'
                 'As a player he was a defender, and played in the Premier '
                 'League for Everton, Derby County, Leicester City and '
                 'Charlton Athletic. He also played in the Football League '
                 'for Cambridge United, Blackpool, Birmingham City and '
                 'Burton Albion. In May 2009 he was appointed assistant '
                 'manager to Paul Peschisolido at Burton, and took over as '
                 'manager in 2012.',
                 ['Playing career',
                  'Management career',
                  'Media career',
                  'Managerial statistics',
                  'References',
                  'External links']],
 'Hartford railway station': ['Hartford_railway_station,_Cheshire_(5).JPG',
                              'Hartford railway station is in the village '
                              'of Hartford, in Cheshire, England. It is '
                              'situated on the A559 road approximately two '
                              'miles (3.2 km) west of the town of Northwich.',
                              ['History',
                               'Facilities',
                               'Services',
                               'References',
                               'External links']],
 'Hollywood Library': ['Hollywood_Library_in_Portland.jpg',
                       'The Hollywood Library is a branch of the Multnomah '
                       'County Library (MCL), in the Hollywood District of '
                       'Portland in the U.S. state of Oregon. The building, '
                       'at N.E. 40th Avenue and Tillamook Street, opened in '
                       '2002, and has three residential stories above the '
                       'library. The previous building, constructed in 1959 '
                       'at N.E. 39th Avenue and Hancock Street, was '
                       'expected to be sold in 2003 to a private party, for '
                       'its appraised price of $675,000. The branch offers '
                       'the MCL catalog of two million books, periodicals '
                       'and other materials.',
                       ['History',
                        'See also',
                        'References',
                        'External links']],
 'Isabel Fonseca': ['',
                    'Isabel Fonseca (born 1961, New York City) is an '
                    'American writer.\n'
                    'She is the youngest of Uruguayan sculptor Gonzalo '
                    "Fonseca's four children, and the sister of the "
                    'painters Caio Fonseca and Bruno Fonseca (1958–1994).\n'
                    'She attended Concord Academy and graduated magna cum '
                    'laude from Barnard College in 1984. She then studied '
                    'at Wadham College, Oxford and worked in publishing and '
                    'newspapers in London, notably at the Times Literary '
                    'Supplement.\n'
                    'She is the author of the bestselling Bury Me Standing: '
                    'The Gypsies and Their Journey (1995), a non-fiction '
                    'book about the lives of Romani people.',
                    ['References', 'External links']],
 'Isocitrate/isopropylmalate dehydrogenase family': ['PDB_1cw4_EBI.jpg',
                                                     'In molecular biology, '
                                                     'the '
                                                     'isocitrate/isopropylmalate '
                                                     'dehydrogenase family '
                                                     'is a protein family '
                                                     'consisting of the '
                                                     'evolutionary related '
                                                     'enzymes isocitrate '
                                                     'dehydrogenase, '
                                                     '3-isopropylmalate '
                                                     'dehydrogenase and '
                                                     'tartrate '
                                                     'dehydrogenase.\n'
                                                     'Isocitrate '
                                                     'dehydrogenase (IDH), '
                                                     'is an important '
                                                     'enzyme of '
                                                     'carbohydrate '
                                                     'metabolism which '
                                                     'catalyses the '
                                                     'oxidative '
                                                     'decarboxylation of '
                                                     'isocitrate into '
                                                     'alpha-ketoglutarate. '
                                                     'IDH is either '
                                                     'dependent on NAD+ EC '
                                                     '1.1.1.41 or on NADP+ '
                                                     'EC 1.1.1.42. In '
                                                     'eukaryotes there are '
                                                     'at least three '
                                                     'isozymes of IDH: two '
                                                     'are located in the '
                                                     'mitochondrial matrix '
                                                     '(one NAD+-dependent, '
                                                     'the other '
                                                     'NADP+-dependent), '
                                                     'while the third one '
                                                     '(also '
                                                     'NADP+-dependent) is '
                                                     'cytoplasmic. In '
                                                     'Escherichia coli the '
                                                     'activity of a '
                                                     'NADP+-dependent form '
                                                     'of the enzyme is '
                                                     'controlled by the '
                                                     'phosphorylation of a '
                                                     'serine residue; the '
                                                     'phosphorylated form '
                                                     'of IDH is completely '
                                                     'inactivated.',
                                                     ['References']],
 'Jack (Homes novel)': ['',
                        'Jack is the 1990 debut novel by American writer A. '
                        'M. Homes, published when she was 19. She wrote the '
                        'novel while attending Sarah Lawrence College. It '
                        'is a bildungsroman or coming-of-age novel, dealing '
                        "with a 15-year-old boy's grappling with issues of "
                        'divorce and sexuality in his family and among his '
                        'friends.',
                        ['Plot',
                         'Characters',
                         'Reception',
                         'Adaptation',
                         'References',
                         'External links']],
 'James Morrill': ['',
                   'James Lewis Morrill (September 24, 1891 – July 1979) '
                   'was a professor and academic administrator who served '
                   'as the president of the University of Wyoming and the '
                   'University of Minnesota. He attended The Ohio State '
                   'University for his undergraduate education and, after a '
                   'brief career as a journalist, he returned there for a '
                   'career in teaching and administration. In 1942 he left '
                   'to accept the position of president at the University '
                   'of Wyoming. After only three years he was recruited to '
                   'become the eighth president of the University of '
                   'Minnesota. During his time at the University of '
                   'Minnesota he oversaw a period of immense growth; '
                   'enrollment at the school more than doubled in a single '
                   'year due in large part to returning servicemen using '
                   'the G.I. Bill to pursue a college education.',
                   ['References']],
 'John Michael Cummings': ["John's_Photo_3.8.2008.jpg",
                           'John Michael Cummings (born 1963 in Harpers '
                           'Ferry, West Virginia) is an American novelist '
                           'and short story writer. His novels include The '
                           'Night I Freed John Brown (Penguin Group, 2008), '
                           'winner of the Paterson Prize for Books for '
                           'Young People;Ugly To Start With (West Virginia '
                           'University Press, 2011), IndieFab Award '
                           "Finalist; and Don't Forget Me, Bro (Stephen F. "
                           "Austin State University Press, 2015). Don't "
                           'Forget Me, Bro has been excerpted in The '
                           'Chicago Tribune.\n'
                           "Cummings' short stories and essays have "
                           'appeared in more than seventy-five literary '
                           'journals, including North American Review, '
                           'Alaska Quarterly Review, The Chattahoochee '
                           'Review, The Kenyon Review, and The Iowa Review. '
                           'His short fiction has been nominated twice for '
                           'the Pushcart Prize.',
                           ['Works', 'References', 'External links']],
 'Kiss': ['William-Adolphe_Bouguereau_(1825-1905)_-_A_Little_Coaxing_(1890).jpg',
          "A kiss is the touch or pressing of one's lips against another "
          'person or an object. Cultural connotations of kissing vary '
          'widely. Depending on the culture and context, a kiss can express '
          'sentiments of love, passion, romance, sexual attraction, sexual '
          'activity, sexual arousal, affection, respect, greeting, '
          'friendship, peace and good luck, among many others. In some '
          'situations a kiss is a ritual, formal or symbolic gesture '
          'indicating devotion, respect, or sacrament. The word came from '
          'Old English cyssan (“to kiss”), in turn from coss (“a kiss”).',
          ['History',
           'Types',
           'Kiss as ritual',
           'Cultural significance',
           'Contemporary practices',
           'Legality',
           'In religion',
           'Biology and evolution',
           'See also',
           'References',
           'Further reading',
           'External links']],
 'List of serial killers before 1900': ['',
                                        'The following is a list of known '
                                        'serial killers active before 1900, '
                                        'in roughly chronological order.',
                                        ['Active before 1600',
                                         '1600 to 1800',
                                         '1801 to 1830',
                                         '1831 to 1850',
                                         '1851 to 1880',
                                         'After 1881',
                                         'Legendary serial killers',
                                         'See also',
                                         'References']],
 'Michael E. Smith': ['',
                      'Michael Ernest Smith (born 1953) is an American '
                      'archaeologist working primarily with Aztec and '
                      'general Mesoamerican archaeology. He has written '
                      'numerous scholarly articles about central Mexican '
                      'archaeology as well as several books about the '
                      'Aztecs, among them a widely used textbook (Smith '
                      '2003). He is currently Professor of Anthropology in '
                      'the School of Human Evolution and Social Change at '
                      'Arizona State University. He is known for stressing '
                      'the importance of assessing archaeological evidence '
                      'independently of the ethnohistorical sources, and '
                      'advocating its use as a source of knowledge about '
                      'the Aztecs.',
                      ['Published works', 'Notes', 'External links']],
 'Murder of Kelly Anne Bates': ['Picture_of_Kelly_Anne_Bates.jpg',
                                'Kelly Anne Bates (18 May 1978 – 16 April '
                                '1996) was a British teenager who was '
                                'murdered in Manchester on 16 April 1996 '
                                'when aged 17. She was tortured over a '
                                'period of four weeks, including having her '
                                'eyes gouged from their sockets up to three '
                                'weeks before her death, by her partner '
                                'James Patterson Smith (born c.\u20091948) '
                                'before being drowned in a bathtub.\n'
                                'The murder inquiry was headed by Detective '
                                'Sergeant Joseph Monaghan of Greater '
                                'Manchester Police, who said: "I have been '
                                'in the police force for 15 years and have '
                                'never seen a case as horrific as this." '
                                'William Lawler, the pathologist who '
                                "examined Bates' body, described her "
                                'injuries as "the worst he had seen on a '
                                'murder victim". Smith, a misogynist with a '
                                'history of violence and torture against '
                                'former lovers, denied murdering Bates but '
                                'was convicted and sentenced to life '
                                'imprisonment on 19 November 1997.',
                                ['Background',
                                 'Murder',
                                 'Trial',
                                 'In the media',
                                 'See also',
                                 'References']],
 "Murke's Collected Silences": ['Heinrich_Boell_Vectogramm_01.JPG',
                                '"Murke\'s Collected Silences" (German: '
                                'Doktor Murkes gesammeltes Schweigen) is a '
                                'short story by German writer Heinrich '
                                'Böll, first published in the Frankfurter '
                                'Hefte in 1955 and in English in 1963. The '
                                'story examines the relationship between '
                                'the generations in post-war Germany and '
                                "the country's post-war surge in religious "
                                'belief.',
                                ['Synopsis',
                                 'See also',
                                 'Notes',
                                 'Further reading']],
 'Nicole Moudaber': ['Nicole_Moudaber_03.jpg',
                     'Nicole Moudaber is a Lebanese-Nigerian music producer '
                     'and DJ born in Nigeria. In 2009, Carl Cox described '
                     'her as "the most underrated DJ" to DJ Magazine, which '
                     'helped to launch her career. Her 2013 debut album '
                     'Believe was Number 1 for a month on the Beatport '
                     'techno, tech house, and deep house charts. Moudaber '
                     'has teamed up with techno notables such as Carl Cox, '
                     'Adam Beyer, etc. and she also launched MOOD Records '
                     'imprint in 2012.',
                     ['Biography',
                      'Discography',
                      'Awards and nominations',
                      'Interviews',
                      'References',
                      'External links']],
 'Opernpassage': ['Opernpassage_Panorama.jpg',
                  'The Opernpassage (opera passage) in the Inner City of '
                  'Vienna is a Grade II listed pedestrian underpass under '
                  'the ring road (Ringstraße). It was opened in 1955, a day '
                  'before the re-opening of the nearby Vienna State Opera.\n'
                  'Designed by architect Adolf Hoch it has been a symbol of '
                  'a modern spirit in architecture and urban planning. '
                  'After more than 50 years the City of Vienna undertook a '
                  'complete restoration of the structure, advised by the '
                  'Federal Office for the Protection of Monuments in '
                  'Austria. The passage was reopened on 17 September 2013.',
                  ['References']],
 'Rashod Moulton': ['',
                    'Rashod Moulton (born January 1, 1981 in St. '
                    'Petersburg, Florida) is a former American football '
                    'cornerback. He was signed by the Jacksonville Jaguars '
                    'as an undrafted free agent in 2007. He played college '
                    'football at the Fort Valley State.\n'
                    'Moulton has also been a member of the Denver Broncos.',
                    ['External links']],
 'Revolution Muslim': ['',
                       'Revolution Muslim (RM) was an organization based in '
                       'New York City that advocated the establishment of a '
                       'traditionalist Islamic state through the removal of '
                       'the current rulers in Muslim-majority nations and '
                       'an end to what they consider "Western imperialism". '
                       'It was founded in 2007 by two American men, one of '
                       'them Jewish, who had converted to Islam.\n'
                       'They operated both on their website '
                       '"RevolutionMuslim.com" and through street preaching '
                       'and protests. They frequently protested outside the '
                       'Islamic Cultural Center of New York, a moderate '
                       'Muslim mosque.\n'
                       'The website was eventually shut down on November '
                       '2010, shortly after the arrest of one of the '
                       'leaders.',
                       ['History',
                        'Analysis',
                        'Times Square car bomb',
                        'Former members',
                        'References',
                        'External links']],
 'Sarah Mason (novelist)': ['',
                            'Sarah Mason (born 19 September 1971) is a '
                            'British novelist of romance novels since 2002. '
                            'In 2003, her debut novel Playing James won the '
                            'Romantic Novel of the Year Award by the '
                            "Romantic Novelists' Association.",
                            ['Biography',
                             'Bibliography',
                             'References and sources']],
 'Sir Elwoodin hiljaiset värit': ['',
                                  'Sir Elwoodin hiljaiset värit is a '
                                  'Finnish rock band, hailing from the '
                                  'Helsinki suburb of Kannelmäki.\n'
                                  'The band formed in 1988 when Juha Lehti '
                                  'and Juha Saaresaho got acquainted while '
                                  'working at the Myyrmäki Youth Centre. '
                                  'Including Pete Loikala, they recorded '
                                  'their first demo tapes. Despite '
                                  'publishing records and touring regularly '
                                  'they did not get a major success until '
                                  'they released the single "Viimeisellä '
                                  'rannalla" in 1993. They scored their '
                                  'biggest success in 1998 with the '
                                  'compilation "Varjoja, varkaita ja '
                                  'vanhoja valokuvia", selling more than '
                                  '30,000 records (in a country of only 5 '
                                  'million), earning them a gold record.',
                                  ['Members',
                                   'Discography',
                                   'External links']],
 "Tell The Wolves I'm Home": ["Tell_The_Wolves_I'm_Home_cover_page.jpg",
                              "Tell The Wolves I'm Home is the debut novel "
                              'of American writer Carol Rifka Brunt, '
                              'published by Random House in 2012. It '
                              'follows the life of a girl whose homosexual '
                              'uncle had died of AIDS in the 1980s, and the '
                              'subsequent friendship she develops with his '
                              'boyfriend.',
                              ['Plot', 'Writing', 'Reception', 'References']],
 'The Queen of the Tearling': ['The_Queen_of_the_Tearling_cover.jpg',
                               'The Queen of the Tearling is the debut '
                               'novel by Erika Johansen. It is set in the '
                               '24th century, and is the first novel of a '
                               'planned fantasy trilogy.',
                               ['Plot',
                                'Reaction',
                                'Film adaptation',
                                'References',
                                'External links']],
 'Thomas Meehan (writer)': ['',
                            'Thomas Edward Meehan (born August 14, 1929) is '
                            'an American writer, best known for Annie, The '
                            'Producers, and Hairspray.',
                            ['Life and career',
                             'References',
                             'External links']],
 'United States Senate elections, 1922 and 1923': ['Cabotlodgenationalportrait.jpg',
                                                   'The United States '
                                                   'Senate elections of '
                                                   '1922 and 1923 was an '
                                                   'election which occurred '
                                                   'in the middle of '
                                                   'Republican President '
                                                   "Warren G. Harding's "
                                                   'term. With the '
                                                   'Republicans divided '
                                                   'between conservative '
                                                   'and progressive '
                                                   'factions, the Democrats '
                                                   'gained six net seats '
                                                   'from the Republicans '
                                                   'while the Farmer-Labor '
                                                   'party gained one. The '
                                                   'Republicans retained '
                                                   'their Senate majority.',
                                                   ['Change in Senate '
                                                    'composition',
                                                    'Gains and losses',
                                                    'Race summaries',
                                                    'See also',
                                                    'References']],
 'Uttar Pradesh': ['Uttar_pradesh_Collage.jpg',
                   'Uttar Pradesh (/ˈʊtər prəˈdɛʃ/, Hindi : उत्तर प्रदेश '
                   'literally "Northern Province"), abbreviated as UP, is '
                   'the most populous state in the Republic of India as '
                   'well as the most populous country subdivision in the '
                   'world. It was created on 1 April 1937 as the United '
                   'Provinces during British rule, and was renamed Uttar '
                   'Pradesh in 1950. Lucknow is the capital city of Uttar '
                   'Pradesh. Ghaziabad, Bulandshahr, Kanpur, Gorakhpur, '
                   'Allahabad, Raebareli, Moradabad, Bareilly, Aligarh, '
                   'Sonbhadra, and Varanasi are known for their industrial '
                   'importance in the state. On 9 November 2000, a new '
                   'state, Uttarakhand, was carved out from the Himalayan '
                   'hill region of Uttar Pradesh.',
                   ['History',
                    'Geography',
                    'Flora and Fauna',
                    'Divisions, districts and cities',
                    'Demographics',
                    'Government and politics',
                    'Crime',
                    'Economy',
                    'Transportation',
                    'Sports',
                    'Education',
                    'Tourism',
                    'Culture',
                    'Media',
                    'See also',
                    'References',
                    'External links']],
 'Will Self': ['13323-Will_Self_Reading_-1660-Edit.jpg',
               'William Woodard Self (born 26 September 1961) is an English '
               'novelist, journalist, political commentator and television '
               'personality.\n'
               'Self is the author of ten novels, five collections of '
               'shorter fiction, three novellas, and five collections of '
               'non-fiction writing. His work has been translated into 22 '
               'languages; his 2002 novel, Dorian was longlisted for the '
               'Booker Prize, and his novel Umbrella was shortlisted for '
               'the Man Booker Prize. His fiction is known for being '
               'satirical, grotesque, and fantastical, and is predominantly '
               'set within his home city of London. His subject matter '
               'often includes mental illness, illegal drugs, and '
               'psychiatry.',
               ['Early life',
                'Career',
                'Literary style',
                'Personal life',
                'Awards',
                'Works',
                'References',
                'External links']],
 'Yazoo and Mississippi Valley Railroad': ['',
                                           'The Yazoo and Mississippi '
                                           'Valley Railroad (Y&MV) was '
                                           'incorporated in 1882 and was '
                                           'part of the Illinois Central '
                                           'Railroad system (IC). '
                                           'Construction began in Jackson, '
                                           'Mississippi, and continued to '
                                           'Yazoo City, Mississippi. The '
                                           'line was later expanded through '
                                           'the Mississippi Delta and on to '
                                           'Memphis, Tennessee. In 1886, '
                                           'the IC purchased the '
                                           'Mississippi and Tennessee '
                                           'Railroad. In 1892, the IC '
                                           'bought the Memphis to New '
                                           'Orleans line, forming the '
                                           'Louisville, New Orleans and '
                                           'Texas Railway.',
                                           ['Blues music',
                                            'See also',
                                            'References',
                                            'External links']]}

WikiVectors recommendations

WikiVectors recommendations are not yet available for all articles in the sample via the WikiVectors API. Ellery provided a JSON file that contains recommendations for 24 articles in the set.

with open('wv_rec_sample.json') as fin:
    wv_sample = json.load(fin)
    
#only use those articles for which there are at least 10 recs
#truncate recs for articles with 10+ recs at 10 (recs are in order)
wv_recs = { k.replace("_", " "):[i[0].replace("_", " ") for i in v[:10]] for k,v in wv_sample.items() if len(v) > 10 }
pprint(wv_recs)
{'2016 Los Angeles Kiss season': ['List of Los Angeles Kiss seasons',
                                  'ArenaBowl XXVI',
                                  '2016 Arizona Rattlers season',
                                  'List of Arena Football League seasons',
                                  '2006 Arena Football League season',
                                  'ArenaBowl XXIII',
                                  '2004 Arena Football League season',
                                  'ArenaBowl XXIV',
                                  'Kevin Guy',
                                  'Los Angeles Kiss'],
 'A Summer Bird-Cage': ['Jerusalem the Golden',
                        'A Glass of Blessings',
                        'Homework (short story)',
                        "The Biographer's Tale",
                        'Lighthousekeeping',
                        'The Pure Gold Baby',
                        'Eva Trout (novel)',
                        'The Beginning of Spring',
                        'The Celestial Omnibus',
                        'Nuns and Soldiers'],
 'Amanda Green': ['Sally Mayes',
                  'Comden and Green',
                  'Lee Roy Reams',
                  'Scott Wise',
                  'Susan Watson',
                  'Lara Teeter',
                  'Barry and Fran Weissler',
                  'Phyllis Newman',
                  'Mimi Hines',
                  'Peter Gennaro'],
 'Andrew Michael Hurley': ['The Sweet Smell of Psychosis',
                           'Nicola Barker',
                           '2015 Costa Book Awards',
                           'How the Dead Live',
                           'The Comforters',
                           'An Evening of Long Goodbyes',
                           'Edward Pygge',
                           'The Lesser Bohemians',
                           'Being Dead',
                           'Sarah Perry'],
 'Cathy Marie Buchanan': ['An East View of the Great Cataract of Niagara',
                          'Marie van Goethem',
                          'The Underpainter',
                          'Alice Elinor Lambert',
                          'Niagara Falls, from the American Side',
                          'Kathleen Morris',
                          'Winslow Homer Studio',
                          'Molly Bobak',
                          'Charles Warren Eaton',
                          'Amelia Alcock-White'],
 'Did You Ever Have a Family': ['Three Junes',
                                'The Turner House',
                                'The Hand That First Held Mine',
                                'Fates and Furies',
                                'Edinburgh (novel)',
                                'Elizabeth Tallent',
                                'To Rise Again at a Decent Hour',
                                'A Gate at the Stairs',
                                'List of Edgar Allan Poe Award for Best '
                                'Young Adult Novel winners',
                                'Bill Clegg'],
 'Don Perata': ['Luis Alejo',
                "California's 13th State Assembly district",
                'Beth Gaines',
                "California's 15th State Assembly district",
                'Dave Cortese',
                'Sandré Swanson',
                'Kevin Mullin',
                'Catharine Baker',
                "California's 16th State Assembly district",
                'California State Senate election, 2016'],
 'Francis Patrick Donovan': ['Tessa Dahl',
                             'Lucy Dahl',
                             'Ophelia Dahl',
                             'Nicholas Logsdail',
                             'Sophie Dahl',
                             'Clare McLaren-Throckmorton',
                             'Julian Holloway',
                             'Patricia Neal',
                             'Memories with Food at Gipsy House',
                             'Jeremy Treglown'],
 'Gary Rowett': ['Lee Johnson (footballer)',
                 'Keith Hill (footballer)',
                 'History of Birmingham City F.C. (1965–present)',
                 'Gary Bowyer',
                 'Ally Mauchlen',
                 'Norwich City F.C. Player of the Season',
                 'Stuart Murdoch (football manager)',
                 'David Lowe (footballer)',
                 'Nigel Clough',
                 'Football League One Manager of the Month'],
 'Hartford railway station': ['Alfreton railway station',
                              'Helsby railway station',
                              'Dunstable Branch Lines',
                              'Buckenham railway station',
                              'Chesterfield Central railway station',
                              'Rushden Parkway railway station',
                              'Leamington to Stratford Line',
                              'Hatfield and St Albans Railway',
                              'Selly Oak railway station',
                              'Northallerton railway station'],
 'Isabel Fonseca': ['Martin Amis',
                    'The Pregnant Widow',
                    'Experience (Martin Amis)',
                    'Adam Foulds',
                    'Yellow Dog (novel)',
                    'Dead Babies (novel)',
                    'Kingsley Amis',
                    'Blitcon',
                    'Anthony Powell',
                    'Heavy Water and Other Stories'],
 'Jack (Homes novel)': ['May We Be Forgiven',
                        'Empress of the World',
                        'The Collected Stories of Jean Stafford',
                        'Arizona Kid',
                        'The Sledding Hill',
                        'Rea Award for the Short Story',
                        'I Am a Woman',
                        'Family Secrets (novel)',
                        'Publishing Triangle',
                        "What My Girlfriend Doesn't Know"],
 'Kiss': ['French kiss',
          'Hug',
          'Foreplay',
          'Physical intimacy',
          'Human sexual activity',
          'Sexual intercourse',
          'Making out',
          'Oral sex',
          'Sexual arousal',
          '69 (sex position)'],
 'List of serial killers before 1900': ['Zu Shenatir',
                                        'Geordie Bourne',
                                        'Liu Pengli',
                                        'List of serial killers in the '
                                        'United States',
                                        'List of serial killers by number '
                                        'of victims',
                                        'Agnus McVee',
                                        'List of serial killers by country',
                                        'Lydia Sherman',
                                        'Jane Toppan',
                                        'List of murderers by number of '
                                        'victims'],
 'Murder of Kelly Anne Bates': ['Murder of Jennifer Daugherty',
                                'Murder of Skylar Neese',
                                'Torture murder',
                                'Terrell Peterson',
                                'Rosemary West',
                                'Mary Bell',
                                'Junko Ogata',
                                'Robert Ben Rhoades',
                                'Peterborough ditch murders',
                                'Murder of Shanda Sharer'],
 'Nicole Moudaber': ['Kerri Chandler',
                     'Intec Digital',
                     'Seth Troxler',
                     'Drumcode Records',
                     'Smokin Jo',
                     'Danny Tenaglia',
                     'Carl Cox',
                     'Booka Shade',
                     'Jay Lumen',
                     'EDX (DJ)'],
 'Opernpassage': ['Meidling Hauptstraße (Vienna U-Bahn)',
                  'Donauinsel (Vienna U-Bahn)',
                  'Währinger Straße-Volksoper (Vienna U-Bahn)',
                  'Gumpendorfer Straße (Vienna U-Bahn)',
                  'Krieau (Vienna U-Bahn)',
                  'Wien Floridsdorf railway station',
                  'Hausfeldstraße (Vienna U-Bahn)',
                  'Kettenbrückengasse (Vienna U-Bahn)',
                  'Reumannplatz (Vienna U-Bahn)',
                  'Handelskai (Vienna U-Bahn)'],
 'Revolution Muslim': ['Zachary Adam Chesser',
                       'Islamic Thinkers Society',
                       'South Park controversies',
                       'Jarret Brachman',
                       '201 (South Park)',
                       '2015 Boston beheading plot',
                       'Inspire (magazine)',
                       'Council on American–Islamic Relations',
                       'The Cartoons that Shook the World',
                       'Everybody Draw Mohammed Day'],
 "Tell The Wolves I'm Home": ['The Night Circus',
                              'Everything I Never Told You',
                              'Side Effects May Vary',
                              'My Heart and Other Black Holes',
                              'A Gate at the Stairs',
                              'Another Brooklyn',
                              'The Vast Fields of Ordinary',
                              'A Certain Slant of Light (novel)',
                              'All the Bright Places',
                              'Drowning Ruth'],
 'The Queen of the Tearling': ['Sarah J. Maas',
                               'Throne of Glass',
                               'Short Stories from Hogwarts of Heroism, '
                               'Hardship and Dangerous Hobbies',
                               'Throne of Glass (novel)',
                               'Short Stories from Hogwarts of Power, '
                               'Politics and Pesky Poltergeists',
                               'Harry Potter and the Cursed Child',
                               'The Wolves of Mercy Falls',
                               'Maggie Stiefvater',
                               'Robert Galbraith (judge)',
                               'Harry Potter prequel'],
 'Thomas Meehan (writer)': ['Wayne Cilento',
                            'Forbidden Broadway Goes to Rehab',
                            'Drama Desk Award for Outstanding Actor in a '
                            'Musical',
                            'Doug Besterman',
                            'Drama Desk Award for Outstanding Lyrics',
                            'Is there life after high school?',
                            "Jack O'Brien (director)",
                            'Susan Stroman',
                            'Mark Hollmann',
                            'John Rando'],
 'Uttar Pradesh': ['List of districts of Uttar Pradesh',
                   'Allahabad division',
                   'Allahabad district',
                   'Agra division',
                   'Saharanpur division',
                   'Bihar',
                   'Agra Presidency',
                   'Lucknow division',
                   'Lucknow',
                   'Faizabad division'],
 'Will Self': ['Jonathan Self',
               'The Unbearable Lightness of Being a Prawn Cracker',
               'Deborah Orr',
               'Psychogeography (book)',
               'Peter Self',
               'The Quantity Theory of Insanity',
               'The Sweet Smell of Psychosis',
               'Umbrella (novel)',
               'My Idea of Fun',
               'Shark (novel)'],
 'Yazoo and Mississippi Valley Railroad': ['Mississippi Central Railroad',
                                           'Mobile and Ohio Railroad',
                                           'Scott, Mississippi',
                                           'List of Mississippi railroads',
                                           'Columbus and Greenville Railway',
                                           'Hudsonville, Mississippi',
                                           'Queen and Crescent Route',
                                           'Grenada Railway',
                                           'Dixie Flyer (train)',
                                           'Missouri and North Arkansas '
                                           'Railroad']}
print(len(wv_recs))
24

CirrusSearch recommendations

For the 24 articles that have WikiVectors recs, gather Morelike recs.

CS_ENDPOINT = 'https://en.wikipedia.org/w/api.php'

cs_params = { 'action' : 'query',
               'format' : 'json',
                 'generator' : 'search',
                 'gsrqiprofile' : 'classic_noboostlinks',
            }

cs_recs = {}

for k in wv_recs.keys():
    cs_params['gsrsearch'] = "morelike:" + k
    cs_response = api_call(CS_ENDPOINT, cs_params)
    if cs_response:
        recs_sorted = sorted(cs_response['query']['pages'].values(), key=itemgetter('index')) #recs not delivered in order
        cs_recs[k] = [r['title'] for r in recs_sorted]
    else:
        print("Error retrieving response from API for " + k)      
pprint(cs_recs)
{'2016 Los Angeles Kiss season': ['2016 Arizona Rattlers season',
                                  '2016 Jacksonville Sharks season',
                                  '2016 Cleveland Gladiators season',
                                  '2016 Portland Steel season',
                                  '2016 Orlando Predators season',
                                  '2016 Tampa Bay Storm season',
                                  '2016 Philadelphia Soul season',
                                  '2002 Navy Midshipmen football team',
                                  'Colin Madison',
                                  '2009 Atlantic Coast Conference football '
                                  'season'],
 'A Summer Bird-Cage': ['Jerusalem the Golden',
                        'The Seven Sisters (novel)',
                        'The Peppered Moth',
                        'Margaret Drabble',
                        'The Garrick Year',
                        'The Pure Gold Baby',
                        'A Touch of Love (1969 film)',
                        'The Ice Age (novel)',
                        'Last Tango in Halifax',
                        "The Needle's Eye (novel)"],
 'Amanda Green': ['Hands on a Hardbody (musical)',
                  'Phyllis Newman',
                  'Terri White',
                  'Janet Krupin',
                  'Hands on a Hard Body: The Documentary',
                  'Joshua Henry',
                  'Andy Blankenbuehler',
                  'Betty Comden',
                  'Julia Murney',
                  'Tom Kitt (musician)'],
 'Andrew Michael Hurley': ['Tartarus Press',
                           'John Connolly (author)',
                           'Sceptre (imprint)',
                           'Michael Arnold',
                           '2015 Costa Book Awards',
                           'Andrew Williams (novelist)',
                           'Dreda Say Mitchell',
                           'Louise Welsh',
                           'Morris Lurie',
                           'Sarah Perry'],
 'Cathy Marie Buchanan': ['Amy Greene',
                          'Irish Country series',
                          "Heather O'Neill",
                          'Andrew Pyper',
                          'Lynn Coady',
                          'Lauren Groff',
                          'Helen Humphreys',
                          'Sheree-Lee Olson',
                          'Courtney Summers',
                          'Across the Universe (novel)'],
 'Did You Ever Have a Family': ['Bill Clegg',
                                'Financial Times and McKinsey Business Book '
                                'of the Year Award',
                                'Liberal Democrats leadership election, 2007',
                                'Harry Reid',
                                'Gorman Bechard',
                                'Who Is Lydia Loveless?',
                                'Kent Women cricket team',
                                'John Hemming (politician)',
                                'United Kingdom general election debates, '
                                '2010',
                                'Nick Clegg'],
 'Don Perata': ['Special election musical chairs',
                'Wilma Chan',
                'California Proposition 11 (2008)',
                'William F. Knowland',
                'Rebecca Kaplan',
                'William Gardner Hewes',
                'Tom Torlakson',
                'California Proposition 57 (2004)',
                'Political career of Arnold Schwarzenegger',
                'William Byron Rumford'],
 'Francis Patrick Donovan': ['Permanent Representative of Australia to the '
                             'World Trade Organization',
                             'Damien Miller',
                             'Ivor Vincent',
                             'John Digby (judge)',
                             'Doug Jones (international arbitrator)',
                             'Zelman Cowen',
                             'Arie Reich',
                             'Libran N. Cabactulan',
                             'Jan Elizabeth Adams',
                             'Charles Powers'],
 'Gary Rowett': ['Kevin Poole',
                 'Mark Sale',
                 'Kevin Summerfield',
                 '2011–12 Burton Albion F.C. season',
                 'Roy McFarland',
                 '2012–13 Burton Albion F.C. season',
                 'Dean Lyness',
                 'Paul Peschisolido',
                 '2016–17 EFL Championship',
                 '2014–15 Football League Championship'],
 'Hartford railway station': ['Greenbank railway station',
                              'Middlewich railway station',
                              'Acton Bridge railway station',
                              'Dunham Massey railway station',
                              'Northwich railway station',
                              'Winsford railway station',
                              'Stechford railway station',
                              'Yardley Wood railway station',
                              'Hale railway station',
                              'Shap railway station'],
 'Isabel Fonseca': ['Bury Me Standing: The Gypsies and Their Journey',
                    'Lily Tuck',
                    'Mary Jo Salter',
                    'Terry Lesser Morris',
                    'Fernanda Eberstadt',
                    'Martin Amis',
                    'Amy Clampitt',
                    'Stacy Schiff',
                    'Michelle Huneven',
                    'Isabel Huggan'],
 'Jack (Homes novel)': ['Jack (2004 film)',
                        'List of California Diaries characters',
                        'The Coming Storm',
                        'Anne of Avonlea',
                        'How I Paid for College: A Novel of Sex, Theft, '
                        'Friendship, and Musical Theater',
                        'Family Secrets (novel)',
                        'Rainbow Boys',
                        'Boy Meets Boy (novel)',
                        'Anything for Love',
                        'Walking the Halls'],
 'Kiss': ['Cheek kissing',
          'Kissing traditions',
          'Eskimo kissing',
          'Air kiss',
          'Kiss of peace',
          'Greeting',
          'Public display of affection',
          'Physical intimacy',
          'Smile',
          'Affection'],
 'List of serial killers before 1900': ['Incidents of necrophilia',
                                        'List of serial killers by number '
                                        'of victims',
                                        'Serial killer',
                                        'Zu Shenatir',
                                        'Hybristophilia',
                                        'Katherine Ramsland',
                                        'Harvey Miguel Robinson',
                                        'True crime',
                                        'Harold Schechter',
                                        'Cleophus Prince Jr.'],
 'Murder of Kelly Anne Bates': ['Murder of Suzanne Capper',
                                'Murder of Tia Rigg',
                                'Murder of Yaseen Ege',
                                'Charles Smith (pathologist)',
                                'Louise Woodward case',
                                'History of violence against LGBT people in '
                                'the United Kingdom',
                                'Murder of Claire Tiltman',
                                'Moors murders',
                                'Bega schoolgirl murders',
                                'Murder of Michael Gilbert'],
 'Nicole Moudaber': ['DJ Awards',
                     'DJ Umek',
                     'Valentino Kanzyani',
                     'Luigi Madonna',
                     'Carl Cox discography',
                     'DC10 (nightclub)',
                     'List of awards and nominations received by Carl Cox',
                     'List of awards and nominations received by Armin van '
                     'Buuren',
                     'Jeremy Olander',
                     'Carl Cox'],
 'Opernpassage': ['Adolf Hoch',
                  'Landstraße',
                  'Steffl Department Store Vienna',
                  'Haas House',
                  'Music and Arts University of the City of Vienna',
                  'Innere Stadt',
                  'Kursalon Hübner',
                  'Pi (art project)',
                  'Ostbahnbrücke',
                  'Vienna Volksoper'],
 'Revolution Muslim': ['Zachary Adam Chesser',
                       'Jihadist extremism in the United States',
                       'Mohammed Wali Zazi',
                       'Terrorists Among Us: Jihad in America',
                       'Johari Abdul-Malik',
                       'List of unsuccessful terrorist plots in the United '
                       'States post-9/11',
                       '2006 Ontario terrorism plot',
                       'Najibullah Zazi',
                       'Jemaah Islamiyah',
                       'Shaker Elsayed'],
 "Tell The Wolves I'm Home": ['Bridget Vreeland',
                              'Switched (Hocking novel)',
                              'Boulevard Nights',
                              "I'll See You in My Dreams (2015 film)",
                              'Cutting It',
                              'A Few Good Men (The Vampire Diaries)',
                              'Sharpe family',
                              'Balto II: Wolf Quest',
                              'List of Switched at Birth characters',
                              "To All the Boys I've Loved Before"],
 'The Queen of the Tearling': ['David Heyman',
                               'Emma Watson',
                               'Production of Harry Potter and the Deathly '
                               'Hallows',
                               'Emma Forrest',
                               'Emily Watson',
                               'Emily Faithfull',
                               'Mary Margaret Blanchard',
                               'Gemma Jones',
                               'Harry Potter and the Order of the Phoenix '
                               '(film)',
                               'Fruit of the Poisonous Tree (Once Upon a '
                               'Time)'],
 'Thomas Meehan (writer)': ['Rocky the Musical',
                            'Cry-Baby (musical)',
                            'Elf: The Musical',
                            'Maury Yeston',
                            'Larry Hochman',
                            'James Lapine',
                            'Tom Sawyer: A Ballet in Three Acts',
                            'Bob Martin (comedian)',
                            'Chaplin (2006 musical)',
                            'Doug Besterman'],
 'Uttar Pradesh': ['List of cities in Uttar Pradesh by population',
                   'List of institutions of higher education in Uttar '
                   'Pradesh',
                   'Economy of Uttar Pradesh',
                   'List of Uttar Pradesh train accidents',
                   'List of North Indian cities by population',
                   'Culture of Uttar Pradesh',
                   'Tourism in Uttar Pradesh',
                   'Education in Uttar Pradesh',
                   'Hindustan (newspaper)',
                   'Uttar Pradesh Heritage Arc'],
 'Will Self': ['Zack Busner',
               'The Quantity Theory of Insanity',
               'Hilary Mantel',
               'S. F. Said',
               'Sathnam Sanghera',
               'Umbrella (novel)',
               'David Mitchell (author)',
               'Frank Cottrell-Boyce',
               'Eleanor Catton',
               'Anthony Ryan (writer)'],
 'Yazoo and Mississippi Valley Railroad': ['Yazoo Delta Railroad',
                                           'Rosedale, Mississippi',
                                           'City of New Orleans (train)',
                                           'Holly Bluff, Mississippi',
                                           'Yazoo and Mississippi Valley '
                                           'Railroad Company Depot',
                                           'Mississippi and Tennessee '
                                           'Railroad',
                                           "I Wonder Where My Easy Rider's "
                                           'Gone',
                                           'Tutwiler, Mississippi',
                                           'Yellow Dog Records',
                                           'W. C. Handy']}
print(len(cs_recs))
24

Get top three recs from each set

The goal is to present the top three unique results from both algorithms to the user, so that they can evaluate which set of recommendations fits their needs better. Sometimes, the two algorithms will serve up one or more of the same recommendations. Seeing duplicates across the two lists can make it more difficult for the user to decide which one they prefer.

  • If the top three are all distinct, we just use those and call it good.
  • If 1 or more members of list A are also in list B...
    1. remove each item from one of the lists (choose randomly - if there in more than one match, make a random selection for each one)
    2. once the match has been removed from one list, the fourth list item is now among the top 3.
    3. check both lists against each other again. are they now de-duped? If so, return them. If not, run it again.
    4. if you reach the end of a list before completing de-duping, end and throw an error
#combine the two dicts of recs.
all_recs = {k:{'cs_recs':cs_recs.get(k),'wv_recs':wv_recs.get(k)} for k in cs_recs.keys() | wv_recs.keys()}
pprint(all_recs)
{'2016 Los Angeles Kiss season': {'cs_recs': ['2016 Arizona Rattlers season',
                                              '2016 Jacksonville Sharks '
                                              'season',
                                              '2016 Cleveland Gladiators '
                                              'season',
                                              '2016 Portland Steel season',
                                              '2016 Orlando Predators '
                                              'season',
                                              '2016 Tampa Bay Storm season',
                                              '2016 Philadelphia Soul '
                                              'season',
                                              '2002 Navy Midshipmen '
                                              'football team',
                                              'Colin Madison',
                                              '2009 Atlantic Coast '
                                              'Conference football season'],
                                  'wv_recs': ['List of Los Angeles Kiss '
                                              'seasons',
                                              'ArenaBowl XXVI',
                                              '2016 Arizona Rattlers season',
                                              'List of Arena Football '
                                              'League seasons',
                                              '2006 Arena Football League '
                                              'season',
                                              'ArenaBowl XXIII',
                                              '2004 Arena Football League '
                                              'season',
                                              'ArenaBowl XXIV',
                                              'Kevin Guy',
                                              'Los Angeles Kiss']},
 'A Summer Bird-Cage': {'cs_recs': ['Jerusalem the Golden',
                                    'The Seven Sisters (novel)',
                                    'The Peppered Moth',
                                    'Margaret Drabble',
                                    'The Garrick Year',
                                    'The Pure Gold Baby',
                                    'A Touch of Love (1969 film)',
                                    'The Ice Age (novel)',
                                    'Last Tango in Halifax',
                                    "The Needle's Eye (novel)"],
                        'wv_recs': ['Jerusalem the Golden',
                                    'A Glass of Blessings',
                                    'Homework (short story)',
                                    "The Biographer's Tale",
                                    'Lighthousekeeping',
                                    'The Pure Gold Baby',
                                    'Eva Trout (novel)',
                                    'The Beginning of Spring',
                                    'The Celestial Omnibus',
                                    'Nuns and Soldiers']},
 'Amanda Green': {'cs_recs': ['Hands on a Hardbody (musical)',
                              'Phyllis Newman',
                              'Terri White',
                              'Janet Krupin',
                              'Hands on a Hard Body: The Documentary',
                              'Joshua Henry',
                              'Andy Blankenbuehler',
                              'Betty Comden',
                              'Julia Murney',
                              'Tom Kitt (musician)'],
                  'wv_recs': ['Sally Mayes',
                              'Comden and Green',
                              'Lee Roy Reams',
                              'Scott Wise',
                              'Susan Watson',
                              'Lara Teeter',
                              'Barry and Fran Weissler',
                              'Phyllis Newman',
                              'Mimi Hines',
                              'Peter Gennaro']},
 'Andrew Michael Hurley': {'cs_recs': ['Tartarus Press',
                                       'John Connolly (author)',
                                       'Sceptre (imprint)',
                                       'Michael Arnold',
                                       '2015 Costa Book Awards',
                                       'Andrew Williams (novelist)',
                                       'Dreda Say Mitchell',
                                       'Louise Welsh',
                                       'Morris Lurie',
                                       'Sarah Perry'],
                           'wv_recs': ['The Sweet Smell of Psychosis',
                                       'Nicola Barker',
                                       '2015 Costa Book Awards',
                                       'How the Dead Live',
                                       'The Comforters',
                                       'An Evening of Long Goodbyes',
                                       'Edward Pygge',
                                       'The Lesser Bohemians',
                                       'Being Dead',
                                       'Sarah Perry']},
 'Cathy Marie Buchanan': {'cs_recs': ['Amy Greene',
                                      'Irish Country series',
                                      "Heather O'Neill",
                                      'Andrew Pyper',
                                      'Lynn Coady',
                                      'Lauren Groff',
                                      'Helen Humphreys',
                                      'Sheree-Lee Olson',
                                      'Courtney Summers',
                                      'Across the Universe (novel)'],
                          'wv_recs': ['An East View of the Great Cataract '
                                      'of Niagara',
                                      'Marie van Goethem',
                                      'The Underpainter',
                                      'Alice Elinor Lambert',
                                      'Niagara Falls, from the American '
                                      'Side',
                                      'Kathleen Morris',
                                      'Winslow Homer Studio',
                                      'Molly Bobak',
                                      'Charles Warren Eaton',
                                      'Amelia Alcock-White']},
 'Did You Ever Have a Family': {'cs_recs': ['Bill Clegg',
                                            'Financial Times and McKinsey '
                                            'Business Book of the Year '
                                            'Award',
                                            'Liberal Democrats leadership '
                                            'election, 2007',
                                            'Harry Reid',
                                            'Gorman Bechard',
                                            'Who Is Lydia Loveless?',
                                            'Kent Women cricket team',
                                            'John Hemming (politician)',
                                            'United Kingdom general '
                                            'election debates, 2010',
                                            'Nick Clegg'],
                                'wv_recs': ['Three Junes',
                                            'The Turner House',
                                            'The Hand That First Held Mine',
                                            'Fates and Furies',
                                            'Edinburgh (novel)',
                                            'Elizabeth Tallent',
                                            'To Rise Again at a Decent Hour',
                                            'A Gate at the Stairs',
                                            'List of Edgar Allan Poe Award '
                                            'for Best Young Adult Novel '
                                            'winners',
                                            'Bill Clegg']},
 'Don Perata': {'cs_recs': ['Special election musical chairs',
                            'Wilma Chan',
                            'California Proposition 11 (2008)',
                            'William F. Knowland',
                            'Rebecca Kaplan',
                            'William Gardner Hewes',
                            'Tom Torlakson',
                            'California Proposition 57 (2004)',
                            'Political career of Arnold Schwarzenegger',
                            'William Byron Rumford'],
                'wv_recs': ['Luis Alejo',
                            "California's 13th State Assembly district",
                            'Beth Gaines',
                            "California's 15th State Assembly district",
                            'Dave Cortese',
                            'Sandré Swanson',
                            'Kevin Mullin',
                            'Catharine Baker',
                            "California's 16th State Assembly district",
                            'California State Senate election, 2016']},
 'Francis Patrick Donovan': {'cs_recs': ['Permanent Representative of '
                                         'Australia to the World Trade '
                                         'Organization',
                                         'Damien Miller',
                                         'Ivor Vincent',
                                         'John Digby (judge)',
                                         'Doug Jones (international '
                                         'arbitrator)',
                                         'Zelman Cowen',
                                         'Arie Reich',
                                         'Libran N. Cabactulan',
                                         'Jan Elizabeth Adams',
                                         'Charles Powers'],
                             'wv_recs': ['Tessa Dahl',
                                         'Lucy Dahl',
                                         'Ophelia Dahl',
                                         'Nicholas Logsdail',
                                         'Sophie Dahl',
                                         'Clare McLaren-Throckmorton',
                                         'Julian Holloway',
                                         'Patricia Neal',
                                         'Memories with Food at Gipsy House',
                                         'Jeremy Treglown']},
 'Gary Rowett': {'cs_recs': ['Kevin Poole',
                             'Mark Sale',
                             'Kevin Summerfield',
                             '2011–12 Burton Albion F.C. season',
                             'Roy McFarland',
                             '2012–13 Burton Albion F.C. season',
                             'Dean Lyness',
                             'Paul Peschisolido',
                             '2016–17 EFL Championship',
                             '2014–15 Football League Championship'],
                 'wv_recs': ['Lee Johnson (footballer)',
                             'Keith Hill (footballer)',
                             'History of Birmingham City F.C. '
                             '(1965–present)',
                             'Gary Bowyer',
                             'Ally Mauchlen',
                             'Norwich City F.C. Player of the Season',
                             'Stuart Murdoch (football manager)',
                             'David Lowe (footballer)',
                             'Nigel Clough',
                             'Football League One Manager of the Month']},
 'Hartford railway station': {'cs_recs': ['Greenbank railway station',
                                          'Middlewich railway station',
                                          'Acton Bridge railway station',
                                          'Dunham Massey railway station',
                                          'Northwich railway station',
                                          'Winsford railway station',
                                          'Stechford railway station',
                                          'Yardley Wood railway station',
                                          'Hale railway station',
                                          'Shap railway station'],
                              'wv_recs': ['Alfreton railway station',
                                          'Helsby railway station',
                                          'Dunstable Branch Lines',
                                          'Buckenham railway station',
                                          'Chesterfield Central railway '
                                          'station',
                                          'Rushden Parkway railway station',
                                          'Leamington to Stratford Line',
                                          'Hatfield and St Albans Railway',
                                          'Selly Oak railway station',
                                          'Northallerton railway station']},
 'Isabel Fonseca': {'cs_recs': ['Bury Me Standing: The Gypsies and Their '
                                'Journey',
                                'Lily Tuck',
                                'Mary Jo Salter',
                                'Terry Lesser Morris',
                                'Fernanda Eberstadt',
                                'Martin Amis',
                                'Amy Clampitt',
                                'Stacy Schiff',
                                'Michelle Huneven',
                                'Isabel Huggan'],
                    'wv_recs': ['Martin Amis',
                                'The Pregnant Widow',
                                'Experience (Martin Amis)',
                                'Adam Foulds',
                                'Yellow Dog (novel)',
                                'Dead Babies (novel)',
                                'Kingsley Amis',
                                'Blitcon',
                                'Anthony Powell',
                                'Heavy Water and Other Stories']},
 'Jack (Homes novel)': {'cs_recs': ['Jack (2004 film)',
                                    'List of California Diaries characters',
                                    'The Coming Storm',
                                    'Anne of Avonlea',
                                    'How I Paid for College: A Novel of '
                                    'Sex, Theft, Friendship, and Musical '
                                    'Theater',
                                    'Family Secrets (novel)',
                                    'Rainbow Boys',
                                    'Boy Meets Boy (novel)',
                                    'Anything for Love',
                                    'Walking the Halls'],
                        'wv_recs': ['May We Be Forgiven',
                                    'Empress of the World',
                                    'The Collected Stories of Jean Stafford',
                                    'Arizona Kid',
                                    'The Sledding Hill',
                                    'Rea Award for the Short Story',
                                    'I Am a Woman',
                                    'Family Secrets (novel)',
                                    'Publishing Triangle',
                                    "What My Girlfriend Doesn't Know"]},
 'Kiss': {'cs_recs': ['Cheek kissing',
                      'Kissing traditions',
                      'Eskimo kissing',
                      'Air kiss',
                      'Kiss of peace',
                      'Greeting',
                      'Public display of affection',
                      'Physical intimacy',
                      'Smile',
                      'Affection'],
          'wv_recs': ['French kiss',
                      'Hug',
                      'Foreplay',
                      'Physical intimacy',
                      'Human sexual activity',
                      'Sexual intercourse',
                      'Making out',
                      'Oral sex',
                      'Sexual arousal',
                      '69 (sex position)']},
 'List of serial killers before 1900': {'cs_recs': ['Incidents of '
                                                    'necrophilia',
                                                    'List of serial '
                                                    'killers by number of '
                                                    'victims',
                                                    'Serial killer',
                                                    'Zu Shenatir',
                                                    'Hybristophilia',
                                                    'Katherine Ramsland',
                                                    'Harvey Miguel Robinson',
                                                    'True crime',
                                                    'Harold Schechter',
                                                    'Cleophus Prince Jr.'],
                                        'wv_recs': ['Zu Shenatir',
                                                    'Geordie Bourne',
                                                    'Liu Pengli',
                                                    'List of serial '
                                                    'killers in the United '
                                                    'States',
                                                    'List of serial '
                                                    'killers by number of '
                                                    'victims',
                                                    'Agnus McVee',
                                                    'List of serial '
                                                    'killers by country',
                                                    'Lydia Sherman',
                                                    'Jane Toppan',
                                                    'List of murderers by '
                                                    'number of victims']},
 'Murder of Kelly Anne Bates': {'cs_recs': ['Murder of Suzanne Capper',
                                            'Murder of Tia Rigg',
                                            'Murder of Yaseen Ege',
                                            'Charles Smith (pathologist)',
                                            'Louise Woodward case',
                                            'History of violence against '
                                            'LGBT people in the United '
                                            'Kingdom',
                                            'Murder of Claire Tiltman',
                                            'Moors murders',
                                            'Bega schoolgirl murders',
                                            'Murder of Michael Gilbert'],
                                'wv_recs': ['Murder of Jennifer Daugherty',
                                            'Murder of Skylar Neese',
                                            'Torture murder',
                                            'Terrell Peterson',
                                            'Rosemary West',
                                            'Mary Bell',
                                            'Junko Ogata',
                                            'Robert Ben Rhoades',
                                            'Peterborough ditch murders',
                                            'Murder of Shanda Sharer']},
 'Nicole Moudaber': {'cs_recs': ['DJ Awards',
                                 'DJ Umek',
                                 'Valentino Kanzyani',
                                 'Luigi Madonna',
                                 'Carl Cox discography',
                                 'DC10 (nightclub)',
                                 'List of awards and nominations received '
                                 'by Carl Cox',
                                 'List of awards and nominations received '
                                 'by Armin van Buuren',
                                 'Jeremy Olander',
                                 'Carl Cox'],
                     'wv_recs': ['Kerri Chandler',
                                 'Intec Digital',
                                 'Seth Troxler',
                                 'Drumcode Records',
                                 'Smokin Jo',
                                 'Danny Tenaglia',
                                 'Carl Cox',
                                 'Booka Shade',
                                 'Jay Lumen',
                                 'EDX (DJ)']},
 'Opernpassage': {'cs_recs': ['Adolf Hoch',
                              'Landstraße',
                              'Steffl Department Store Vienna',
                              'Haas House',
                              'Music and Arts University of the City of '
                              'Vienna',
                              'Innere Stadt',
                              'Kursalon Hübner',
                              'Pi (art project)',
                              'Ostbahnbrücke',
                              'Vienna Volksoper'],
                  'wv_recs': ['Meidling Hauptstraße (Vienna U-Bahn)',
                              'Donauinsel (Vienna U-Bahn)',
                              'Währinger Straße-Volksoper (Vienna U-Bahn)',
                              'Gumpendorfer Straße (Vienna U-Bahn)',
                              'Krieau (Vienna U-Bahn)',
                              'Wien Floridsdorf railway station',
                              'Hausfeldstraße (Vienna U-Bahn)',
                              'Kettenbrückengasse (Vienna U-Bahn)',
                              'Reumannplatz (Vienna U-Bahn)',
                              'Handelskai (Vienna U-Bahn)']},
 'Revolution Muslim': {'cs_recs': ['Zachary Adam Chesser',
                                   'Jihadist extremism in the United States',
                                   'Mohammed Wali Zazi',
                                   'Terrorists Among Us: Jihad in America',
                                   'Johari Abdul-Malik',
                                   'List of unsuccessful terrorist plots '
                                   'in the United States post-9/11',
                                   '2006 Ontario terrorism plot',
                                   'Najibullah Zazi',
                                   'Jemaah Islamiyah',
                                   'Shaker Elsayed'],
                       'wv_recs': ['Zachary Adam Chesser',
                                   'Islamic Thinkers Society',
                                   'South Park controversies',
                                   'Jarret Brachman',
                                   '201 (South Park)',
                                   '2015 Boston beheading plot',
                                   'Inspire (magazine)',
                                   'Council on American–Islamic Relations',
                                   'The Cartoons that Shook the World',
                                   'Everybody Draw Mohammed Day']},
 "Tell The Wolves I'm Home": {'cs_recs': ['Bridget Vreeland',
                                          'Switched (Hocking novel)',
                                          'Boulevard Nights',
                                          "I'll See You in My Dreams (2015 "
                                          'film)',
                                          'Cutting It',
                                          'A Few Good Men (The Vampire '
                                          'Diaries)',
                                          'Sharpe family',
                                          'Balto II: Wolf Quest',
                                          'List of Switched at Birth '
                                          'characters',
                                          "To All the Boys I've Loved "
                                          'Before'],
                              'wv_recs': ['The Night Circus',
                                          'Everything I Never Told You',
                                          'Side Effects May Vary',
                                          'My Heart and Other Black Holes',
                                          'A Gate at the Stairs',
                                          'Another Brooklyn',
                                          'The Vast Fields of Ordinary',
                                          'A Certain Slant of Light (novel)',
                                          'All the Bright Places',
                                          'Drowning Ruth']},
 'The Queen of the Tearling': {'cs_recs': ['David Heyman',
                                           'Emma Watson',
                                           'Production of Harry Potter and '
                                           'the Deathly Hallows',
                                           'Emma Forrest',
                                           'Emily Watson',
                                           'Emily Faithfull',
                                           'Mary Margaret Blanchard',
                                           'Gemma Jones',
                                           'Harry Potter and the Order of '
                                           'the Phoenix (film)',
                                           'Fruit of the Poisonous Tree '
                                           '(Once Upon a Time)'],
                               'wv_recs': ['Sarah J. Maas',
                                           'Throne of Glass',
                                           'Short Stories from Hogwarts of '
                                           'Heroism, Hardship and '
                                           'Dangerous Hobbies',
                                           'Throne of Glass (novel)',
                                           'Short Stories from Hogwarts of '
                                           'Power, Politics and Pesky '
                                           'Poltergeists',
                                           'Harry Potter and the Cursed '
                                           'Child',
                                           'The Wolves of Mercy Falls',
                                           'Maggie Stiefvater',
                                           'Robert Galbraith (judge)',
                                           'Harry Potter prequel']},
 'Thomas Meehan (writer)': {'cs_recs': ['Rocky the Musical',
                                        'Cry-Baby (musical)',
                                        'Elf: The Musical',
                                        'Maury Yeston',
                                        'Larry Hochman',
                                        'James Lapine',
                                        'Tom Sawyer: A Ballet in Three Acts',
                                        'Bob Martin (comedian)',
                                        'Chaplin (2006 musical)',
                                        'Doug Besterman'],
                            'wv_recs': ['Wayne Cilento',
                                        'Forbidden Broadway Goes to Rehab',
                                        'Drama Desk Award for Outstanding '
                                        'Actor in a Musical',
                                        'Doug Besterman',
                                        'Drama Desk Award for Outstanding '
                                        'Lyrics',
                                        'Is there life after high school?',
                                        "Jack O'Brien (director)",
                                        'Susan Stroman',
                                        'Mark Hollmann',
                                        'John Rando']},
 'Uttar Pradesh': {'cs_recs': ['List of cities in Uttar Pradesh by '
                               'population',
                               'List of institutions of higher education '
                               'in Uttar Pradesh',
                               'Economy of Uttar Pradesh',
                               'List of Uttar Pradesh train accidents',
                               'List of North Indian cities by population',
                               'Culture of Uttar Pradesh',
                               'Tourism in Uttar Pradesh',
                               'Education in Uttar Pradesh',
                               'Hindustan (newspaper)',
                               'Uttar Pradesh Heritage Arc'],
                   'wv_recs': ['List of districts of Uttar Pradesh',
                               'Allahabad division',
                               'Allahabad district',
                               'Agra division',
                               'Saharanpur division',
                               'Bihar',
                               'Agra Presidency',
                               'Lucknow division',
                               'Lucknow',
                               'Faizabad division']},
 'Will Self': {'cs_recs': ['Zack Busner',
                           'The Quantity Theory of Insanity',
                           'Hilary Mantel',
                           'S. F. Said',
                           'Sathnam Sanghera',
                           'Umbrella (novel)',
                           'David Mitchell (author)',
                           'Frank Cottrell-Boyce',
                           'Eleanor Catton',
                           'Anthony Ryan (writer)'],
               'wv_recs': ['Jonathan Self',
                           'The Unbearable Lightness of Being a Prawn '
                           'Cracker',
                           'Deborah Orr',
                           'Psychogeography (book)',
                           'Peter Self',
                           'The Quantity Theory of Insanity',
                           'The Sweet Smell of Psychosis',
                           'Umbrella (novel)',
                           'My Idea of Fun',
                           'Shark (novel)']},
 'Yazoo and Mississippi Valley Railroad': {'cs_recs': ['Yazoo Delta '
                                                       'Railroad',
                                                       'Rosedale, '
                                                       'Mississippi',
                                                       'City of New '
                                                       'Orleans (train)',
                                                       'Holly Bluff, '
                                                       'Mississippi',
                                                       'Yazoo and '
                                                       'Mississippi Valley '
                                                       'Railroad Company '
                                                       'Depot',
                                                       'Mississippi and '
                                                       'Tennessee Railroad',
                                                       'I Wonder Where My '
                                                       "Easy Rider's Gone",
                                                       'Tutwiler, '
                                                       'Mississippi',
                                                       'Yellow Dog Records',
                                                       'W. C. Handy'],
                                           'wv_recs': ['Mississippi '
                                                       'Central Railroad',
                                                       'Mobile and Ohio '
                                                       'Railroad',
                                                       'Scott, Mississippi',
                                                       'List of '
                                                       'Mississippi '
                                                       'railroads',
                                                       'Columbus and '
                                                       'Greenville Railway',
                                                       'Hudsonville, '
                                                       'Mississippi',
                                                       'Queen and Crescent '
                                                       'Route',
                                                       'Grenada Railway',
                                                       'Dixie Flyer (train)',
                                                       'Missouri and North '
                                                       'Arkansas Railroad']}}
#note: would be interesting to see how many of the above are shared between the two lists, per article
def distinct_lists(my_lists): #takes a list of two lists inside it. position matters.
        
    atop = my_lists[0][0:3]
#     print(atop)
    btop = my_lists[1][0:3]
#     print(btop)
    if not any(i in btop for i in atop):
#         print("no more dupes")
        return atop, btop
    elif (len(my_lists[0]) > 3 and len(my_lists[1]) > 3):
#         print("found a dupe")
        dupes = [x for x in atop if x in btop]
#         print(dupes)
        item_to_remove = dupes[0]
        seed()
        list_to_prune = choice(my_lists)
#         print(list_to_prune)
#         print(my_lists)
        list_to_prune.remove(item_to_remove)
#         print(my_lists)
        return distinct_lists(my_lists)    
    else: 
#         print(len(my_lists[0]))
#         print(len(my_lists[1]))

        print("ran out of options, couldn't find three distinct") #need to return something, so the script doesn't choke?
top3_recs = {}

for k,v in all_recs.items():
    #can I assign the result of the function to two variables, positionally, to help retain ordering?
    top3 = distinct_lists([v['cs_recs'],v['wv_recs']]) #input order matches output order
    top3_recs[k] = {'cs_recs' : top3[0], 'wv_recs' : top3[1]}
pprint(top3_recs)
{'2016 Los Angeles Kiss season': {'cs_recs': ['2016 Arizona Rattlers season',
                                              '2016 Jacksonville Sharks '
                                              'season',
                                              '2016 Cleveland Gladiators '
                                              'season'],
                                  'wv_recs': ['List of Los Angeles Kiss '
                                              'seasons',
                                              'ArenaBowl XXVI',
                                              'List of Arena Football '
                                              'League seasons']},
 'A Summer Bird-Cage': {'cs_recs': ['The Seven Sisters (novel)',
                                    'The Peppered Moth',
                                    'Margaret Drabble'],
                        'wv_recs': ['Jerusalem the Golden',
                                    'A Glass of Blessings',
                                    'Homework (short story)']},
 'Amanda Green': {'cs_recs': ['Hands on a Hardbody (musical)',
                              'Phyllis Newman',
                              'Terri White'],
                  'wv_recs': ['Sally Mayes',
                              'Comden and Green',
                              'Lee Roy Reams']},
 'Andrew Michael Hurley': {'cs_recs': ['Tartarus Press',
                                       'John Connolly (author)',
                                       'Sceptre (imprint)'],
                           'wv_recs': ['The Sweet Smell of Psychosis',
                                       'Nicola Barker',
                                       '2015 Costa Book Awards']},
 'Cathy Marie Buchanan': {'cs_recs': ['Amy Greene',
                                      'Irish Country series',
                                      "Heather O'Neill"],
                          'wv_recs': ['An East View of the Great Cataract '
                                      'of Niagara',
                                      'Marie van Goethem',
                                      'The Underpainter']},
 'Did You Ever Have a Family': {'cs_recs': ['Bill Clegg',
                                            'Financial Times and McKinsey '
                                            'Business Book of the Year '
                                            'Award',
                                            'Liberal Democrats leadership '
                                            'election, 2007'],
                                'wv_recs': ['Three Junes',
                                            'The Turner House',
                                            'The Hand That First Held Mine']},
 'Don Perata': {'cs_recs': ['Special election musical chairs',
                            'Wilma Chan',
                            'California Proposition 11 (2008)'],
                'wv_recs': ['Luis Alejo',
                            "California's 13th State Assembly district",
                            'Beth Gaines']},
 'Francis Patrick Donovan': {'cs_recs': ['Permanent Representative of '
                                         'Australia to the World Trade '
                                         'Organization',
                                         'Damien Miller',
                                         'Ivor Vincent'],
                             'wv_recs': ['Tessa Dahl',
                                         'Lucy Dahl',
                                         'Ophelia Dahl']},
 'Gary Rowett': {'cs_recs': ['Kevin Poole', 'Mark Sale', 'Kevin Summerfield'],
                 'wv_recs': ['Lee Johnson (footballer)',
                             'Keith Hill (footballer)',
                             'History of Birmingham City F.C. '
                             '(1965–present)']},
 'Hartford railway station': {'cs_recs': ['Greenbank railway station',
                                          'Middlewich railway station',
                                          'Acton Bridge railway station'],
                              'wv_recs': ['Alfreton railway station',
                                          'Helsby railway station',
                                          'Dunstable Branch Lines']},
 'Isabel Fonseca': {'cs_recs': ['Bury Me Standing: The Gypsies and Their '
                                'Journey',
                                'Lily Tuck',
                                'Mary Jo Salter'],
                    'wv_recs': ['Martin Amis',
                                'The Pregnant Widow',
                                'Experience (Martin Amis)']},
 'Jack (Homes novel)': {'cs_recs': ['Jack (2004 film)',
                                    'List of California Diaries characters',
                                    'The Coming Storm'],
                        'wv_recs': ['May We Be Forgiven',
                                    'Empress of the World',
                                    'The Collected Stories of Jean Stafford']},
 'Kiss': {'cs_recs': ['Cheek kissing',
                      'Kissing traditions',
                      'Eskimo kissing'],
          'wv_recs': ['French kiss', 'Hug', 'Foreplay']},
 'List of serial killers before 1900': {'cs_recs': ['Incidents of '
                                                    'necrophilia',
                                                    'List of serial '
                                                    'killers by number of '
                                                    'victims',
                                                    'Serial killer'],
                                        'wv_recs': ['Zu Shenatir',
                                                    'Geordie Bourne',
                                                    'Liu Pengli']},
 'Murder of Kelly Anne Bates': {'cs_recs': ['Murder of Suzanne Capper',
                                            'Murder of Tia Rigg',
                                            'Murder of Yaseen Ege'],
                                'wv_recs': ['Murder of Jennifer Daugherty',
                                            'Murder of Skylar Neese',
                                            'Torture murder']},
 'Nicole Moudaber': {'cs_recs': ['DJ Awards',
                                 'DJ Umek',
                                 'Valentino Kanzyani'],
                     'wv_recs': ['Kerri Chandler',
                                 'Intec Digital',
                                 'Seth Troxler']},
 'Opernpassage': {'cs_recs': ['Adolf Hoch',
                              'Landstraße',
                              'Steffl Department Store Vienna'],
                  'wv_recs': ['Meidling Hauptstraße (Vienna U-Bahn)',
                              'Donauinsel (Vienna U-Bahn)',
                              'Währinger Straße-Volksoper (Vienna U-Bahn)']},
 'Revolution Muslim': {'cs_recs': ['Zachary Adam Chesser',
                                   'Jihadist extremism in the United States',
                                   'Mohammed Wali Zazi'],
                       'wv_recs': ['Islamic Thinkers Society',
                                   'South Park controversies',
                                   'Jarret Brachman']},
 "Tell The Wolves I'm Home": {'cs_recs': ['Bridget Vreeland',
                                          'Switched (Hocking novel)',
                                          'Boulevard Nights'],
                              'wv_recs': ['The Night Circus',
                                          'Everything I Never Told You',
                                          'Side Effects May Vary']},
 'The Queen of the Tearling': {'cs_recs': ['David Heyman',
                                           'Emma Watson',
                                           'Production of Harry Potter and '
                                           'the Deathly Hallows'],
                               'wv_recs': ['Sarah J. Maas',
                                           'Throne of Glass',
                                           'Short Stories from Hogwarts of '
                                           'Heroism, Hardship and '
                                           'Dangerous Hobbies']},
 'Thomas Meehan (writer)': {'cs_recs': ['Rocky the Musical',
                                        'Cry-Baby (musical)',
                                        'Elf: The Musical'],
                            'wv_recs': ['Wayne Cilento',
                                        'Forbidden Broadway Goes to Rehab',
                                        'Drama Desk Award for Outstanding '
                                        'Actor in a Musical']},
 'Uttar Pradesh': {'cs_recs': ['List of cities in Uttar Pradesh by '
                               'population',
                               'List of institutions of higher education '
                               'in Uttar Pradesh',
                               'Economy of Uttar Pradesh'],
                   'wv_recs': ['List of districts of Uttar Pradesh',
                               'Allahabad division',
                               'Allahabad district']},
 'Will Self': {'cs_recs': ['Zack Busner',
                           'The Quantity Theory of Insanity',
                           'Hilary Mantel'],
               'wv_recs': ['Jonathan Self',
                           'The Unbearable Lightness of Being a Prawn '
                           'Cracker',
                           'Deborah Orr']},
 'Yazoo and Mississippi Valley Railroad': {'cs_recs': ['Yazoo Delta '
                                                       'Railroad',
                                                       'Rosedale, '
                                                       'Mississippi',
                                                       'City of New '
                                                       'Orleans (train)'],
                                           'wv_recs': ['Mississippi '
                                                       'Central Railroad',
                                                       'Mobile and Ohio '
                                                       'Railroad',
                                                       'Scott, Mississippi']}}

Recommended article info

def recommendation_info(recs): # an ordered list of 3 recs
    RI_ENDPOINT = 'https://en.wikipedia.org/w/api.php'

    recs_info = []

    #API results list not necesarily in the same order as piped titles when requesting multiple results
    #so requesting one title at a time
    for r in recs:
        ri_params = {'action' : 'query',
                'prop' : 'pageterms|pageimages',
                'format' : 'json', 
                'formatversion' : 2, #pages as list, not dict with page_id as key
                'titles' : r,
                }        
        ri_response = api_call(RI_ENDPOINT, ri_params)['query']['pages'][0]#see if this works
        r_info = {'title':r}
        if 'description' in ri_response['terms'].keys():
            r_info['description'] = ri_response['terms']['description'][0]   
        else:
            r_info['description'] = ''
        if 'pageimage' in ri_response.keys():
            r_info['pageimage'] = ri_response['pageimage']
        else:
            r_info['pageimage'] = "Antu_folder-camera.svg"            

        #now run a new API query to get the first sentence of the recommended page
        ri_params['prop'] = 'extracts'
        ri_params['exsentences'] = 1
        ri_params['exintro'] = True
        ri_params['explaintext'] = True
        ri_response2 = api_call(RI_ENDPOINT, ri_params)['query']['pages'][0]
        r_info['extract'] = ri_response2['extract']  
        recs_info.append(r_info)             
    
    return recs_info #an ordered list of dicts for 3 recs
         
#take my newly-formatted top3_recs item and get the info on each rec, preserving order

top3_recs_info = {}

for k,v in top3_recs.items():
    top3_recs_info[k] = {'cs_recs':None, 'wv_recs':None}
    top3_recs_info[k]['cs_recs'] = recommendation_info(v['cs_recs'])
    top3_recs_info[k]['wv_recs'] = recommendation_info(v['wv_recs'])
pprint(top3_recs_info)
{'2016 Los Angeles Kiss season': {'cs_recs': [{'description': '',
                                               'extract': 'The 2016 '
                                                          'Arizona '
                                                          'Rattlers '
                                                          'season was the '
                                                          'twenty-fourth '
                                                          'season for the '
                                                          'arena football '
                                                          'franchise in '
                                                          'the Arena '
                                                          'Football '
                                                          'League.',
                                               'pageimage': 'Antu_folder-camera.svg',
                                               'title': '2016 Arizona '
                                                        'Rattlers season'},
                                              {'description': '',
                                               'extract': 'The 2016 '
                                                          'Jacksonville '
                                                          'Sharks season '
                                                          'was the '
                                                          'seventh season '
                                                          'for the '
                                                          'franchise in '
                                                          'the Arena '
                                                          'Football '
                                                          'League (AFL).',
                                               'pageimage': 'Antu_folder-camera.svg',
                                               'title': '2016 '
                                                        'Jacksonville '
                                                        'Sharks season'},
                                              {'description': '',
                                               'extract': 'The 2016 '
                                                          'Cleveland '
                                                          'Gladiators '
                                                          'season was the '
                                                          '17th season '
                                                          'for the '
                                                          'franchise in '
                                                          'the Arena '
                                                          'Football '
                                                          'League, and '
                                                          'their seventh '
                                                          'while in '
                                                          'Cleveland.',
                                               'pageimage': 'Antu_folder-camera.svg',
                                               'title': '2016 Cleveland '
                                                        'Gladiators season'}],
                                  'wv_recs': [{'description': '',
                                               'extract': 'This is a list '
                                                          'of seasons '
                                                          'completed by '
                                                          'the Los '
                                                          'Angeles Kiss.',
                                               'pageimage': 'Antu_folder-camera.svg',
                                               'title': 'List of Los '
                                                        'Angeles Kiss '
                                                        'seasons'},
                                              {'description': '',
                                               'extract': 'ArenaBowl XXVI '
                                                          'was the 26th '
                                                          'edition of the '
                                                          'championship '
                                                          'in the Arena '
                                                          'Football '
                                                          'League.',
                                               'pageimage': 'ArenaBowl_XXVI.jpg',
                                               'title': 'ArenaBowl XXVI'},
                                              {'description': 'Wikimedia '
                                                              'list '
                                                              'article',
                                               'extract': 'This is a list '
                                                          'of Arena '
                                                          'Football '
                                                          'League seasons '
                                                          'since the '
                                                          'league started '
                                                          'in 1987.',
                                               'pageimage': 'Antu_folder-camera.svg',
                                               'title': 'List of Arena '
                                                        'Football League '
                                                        'seasons'}]},
 'A Summer Bird-Cage': {'cs_recs': [{'description': '',
                                     'extract': 'The Seven Sisters is a '
                                                '1992 novel by British '
                                                'novelist Margaret '
                                                'Drabble.',
                                     'pageimage': 'Antu_folder-camera.svg',
                                     'title': 'The Seven Sisters (novel)'},
                                    {'description': '',
                                     'extract': 'The Peppered Moth is a '
                                                '2000 novel by English '
                                                'writer Margaret Drabble; '
                                                'it is her fourteenth '
                                                'published novel.',
                                     'pageimage': 'ThePepperedMoth.jpg',
                                     'title': 'The Peppered Moth'},
                                    {'description': 'Novelist, biographer '
                                                    'and critic',
                                     'extract': 'Dame Margaret Drabble, '
                                                'Lady Holroyd DBE FRSL '
                                                '(born 5 June 1939), is '
                                                'an English novelist, '
                                                'biographer, and critic.',
                                     'pageimage': 'Margaret_Drabble_(2011).jpg',
                                     'title': 'Margaret Drabble'}],
                        'wv_recs': [{'description': 'novel by Margaret '
                                                    'Drabble',
                                     'extract': 'Jerusalem the Golden is '
                                                'a novel by Margaret '
                                                'Drabble published in '
                                                '1967, and is a winner of '
                                                'the James Tait Black '
                                                'Memorial Prize in 1967.',
                                     'pageimage': 'JerusalemTheGolden.jpg',
                                     'title': 'Jerusalem the Golden'},
                                    {'description': '',
                                     'extract': 'A Glass of Blessings is '
                                                'a novel by Barbara Pym, '
                                                'first published in 1958.',
                                     'pageimage': 'AGlassOfBlessings.jpg',
                                     'title': 'A Glass of Blessings'},
                                    {'description': '',
                                     'extract': '"Homework" is a short '
                                                'story written by Helen '
                                                'Simpson and was '
                                                'published in 2007.',
                                     'pageimage': 'Antu_folder-camera.svg',
                                     'title': 'Homework (short story)'}]},
 'Amanda Green': {'cs_recs': [{'description': '',
                               'extract': 'Hands on a Hardbody is a '
                                          'musical based on the '
                                          'documentary film Hands on a '
                                          'Hardbody.',
                               'pageimage': 'Hands_on_a_Hardbody_Musical.jpg',
                               'title': 'Hands on a Hardbody (musical)'},
                              {'description': 'American actress and siner',
                               'extract': 'Phyllis Newman (born March 19, '
                                          '1933) is an American actress '
                                          'and singer.',
                               'pageimage': 'Phyllis_Newman_1966.jpg',
                               'title': 'Phyllis Newman'},
                              {'description': 'American singer-actor',
                               'extract': 'Terri White is an American '
                                          'singer and actress, raised in '
                                          'Palo Alto, California.',
                               'pageimage': 'Antu_folder-camera.svg',
                               'title': 'Terri White'}],
                  'wv_recs': [{'description': 'American actress',
                               'extract': 'Sally Lee Mayes (born 1959) is '
                                          'an American actress and '
                                          'cabaret and concert singer.',
                               'pageimage': 'Antu_folder-camera.svg',
                               'title': 'Sally Mayes'},
                              {'description': '',
                               'extract': 'Comden and Green refers to the '
                                          '60-year writing partnership of '
                                          'Betty Comden (1917–2006) and '
                                          'Adolph Green (1914–2002)',
                               'pageimage': 'Antu_folder-camera.svg',
                               'title': 'Comden and Green'},
                              {'description': 'American actor, dancer and '
                                              'singer',
                               'extract': 'Lee Roy Reams (born August 23, '
                                          '1942) is an American musical '
                                          'theatre actor, singer, dancer, '
                                          'choreographer, and director.',
                               'pageimage': 'Antu_folder-camera.svg',
                               'title': 'Lee Roy Reams'}]},
 'Andrew Michael Hurley': {'cs_recs': [{'description': '',
                                        'extract': 'Tartarus Press is an '
                                                   'independent book '
                                                   'publisher based near '
                                                   'Leyburn, Yorkshire, '
                                                   'UK.',
                                        'pageimage': 'Antu_folder-camera.svg',
                                        'title': 'Tartarus Press'},
                                       {'description': 'author',
                                        'extract': 'John Connolly (born '
                                                   '31 May 1968, Dublin) '
                                                   'is an Irish writer '
                                                   'who is best known for '
                                                   'his series of novels '
                                                   'starring private '
                                                   'detective Charlie '
                                                   'Parker.',
                                        'pageimage': 'Connolly,_John.jpg',
                                        'title': 'John Connolly (author)'},
                                       {'description': '',
                                        'extract': 'Sceptre is an imprint '
                                                   'of Hodder & '
                                                   'Stoughton, a British '
                                                   'publishing house '
                                                   'which is a division '
                                                   'of Hachette UK.',
                                        'pageimage': 'Sceptre_Logo.jpg',
                                        'title': 'Sceptre (imprint)'}],
                           'wv_recs': [{'description': '',
                                        'extract': 'The Sweet Smell of '
                                                   'Psychosis is Will '
                                                   "Self's first "
                                                   'published novella.',
                                        'pageimage': 'TheSweetSmellOfPsychosis.jpg',
                                        'title': 'The Sweet Smell of '
                                                 'Psychosis'},
                                       {'description': 'English novelist',
                                        'extract': 'Nicola Barker (born '
                                                   '30 March 1966) is an '
                                                   'English novelist and '
                                                   'short story writer.',
                                        'pageimage': 'Antu_folder-camera.svg',
                                        'title': 'Nicola Barker'},
                                       {'description': '',
                                        'extract': 'The Costa Book Awards '
                                                   '(before 2006 known as '
                                                   'the Whitbread Awards) '
                                                   'are among the United '
                                                   "Kingdom's most "
                                                   'prestigious literary '
                                                   'awards.',
                                        'pageimage': 'Antu_folder-camera.svg',
                                        'title': '2015 Costa Book Awards'}]},
 'Cathy Marie Buchanan': {'cs_recs': [{'description': 'Novelist',
                                       'extract': 'Amy Elizabeth Greene '
                                                  '(born October 2, 1975) '
                                                  'is an American '
                                                  'novelist.',
                                       'pageimage': 'Antu_folder-camera.svg',
                                       'title': 'Amy Greene'},
                                      {'description': '',
                                       'extract': 'The Irish Country '
                                                  'Novels are an ongoing '
                                                  'series of historical '
                                                  'fiction books written '
                                                  'by Patrick Taylor and '
                                                  'published by Forge '
                                                  'Books.',
                                       'pageimage': 'Antu_folder-camera.svg',
                                       'title': 'Irish Country series'},
                                      {'description': 'Canadian writer',
                                       'extract': "Heather O'Neill (born "
                                                  '1973) is a Canadian '
                                                  'novelist, poet, short '
                                                  'story writer, '
                                                  'screenwriter and '
                                                  'journalist, who '
                                                  'published her debut '
                                                  'novel, Lullabies for '
                                                  'Little Criminals, in '
                                                  '2006.',
                                       'pageimage': "Heather_O'Neill_Speaking_at_Festival_in_2016.png",
                                       'title': "Heather O'Neill"}],
                          'wv_recs': [{'description': 'painting by Thomas '
                                                      'Davies',
                                       'extract': 'An East View of the '
                                                  'Great Cataract of '
                                                  'Niagara is a historic '
                                                  'watercolour of Niagara '
                                                  'Falls painted on site '
                                                  'by Thomas Davies '
                                                  '(c.\u20091737–1812) in '
                                                  '1762.',
                                       'pageimage': 'An_East_View_of_the_Great_Cataract_of_Niagara_-_Thomas_Davies.jpg',
                                       'title': 'An East View of the '
                                                'Great Cataract of Niagara'},
                                      {'description': 'French ballet '
                                                      'student and model',
                                       'extract': 'Marie Geneviève van '
                                                  'Goethem (or Goetham or '
                                                  'Goeuthen; 7 June 1865 '
                                                  '– ?) was a French '
                                                  'ballet student and '
                                                  'dancer with the Paris '
                                                  'Opera Ballet, and the '
                                                  'model for Edgar '
                                                  "Degas's statue La "
                                                  'Petite Danseuse de '
                                                  'Quatorze Ans.',
                                       'pageimage': 'WLANL_-_Artshooter_-_Kleine_Danseres_-_detail.jpg',
                                       'title': 'Marie van Goethem'},
                                      {'description': '',
                                       'extract': 'The Underpainter is a '
                                                  'novel by Jane Urquhart '
                                                  'that won the 1997 '
                                                  "Governor General's "
                                                  'Award for '
                                                  'English-language '
                                                  'fiction, and in the '
                                                  'same year was a '
                                                  'finalist for the '
                                                  "Rogers Writers' Trust "
                                                  'Fiction Prize.',
                                       'pageimage': 'Antu_folder-camera.svg',
                                       'title': 'The Underpainter'}]},
 'Did You Ever Have a Family': {'cs_recs': [{'description': 'American '
                                                            'literary '
                                                            'agent and '
                                                            'author',
                                             'extract': 'Bill Clegg is an '
                                                        'American '
                                                        'literary agent '
                                                        'and author.',
                                             'pageimage': 'Antu_folder-camera.svg',
                                             'title': 'Bill Clegg'},
                                            {'description': '',
                                             'extract': 'Financial Times '
                                                        'and McKinsey '
                                                        'Business Book of '
                                                        'the Year Award '
                                                        'is an annual '
                                                        'award given to '
                                                        'the best '
                                                        'business book of '
                                                        'the year as '
                                                        'determined by '
                                                        'the Financial '
                                                        'Times and '
                                                        'McKinsey & '
                                                        'Company.',
                                             'pageimage': 'Steve_Coll_-_FT_Goldman_Sachs_Business_Book_of_the_Year_Award_2012.jpg',
                                             'title': 'Financial Times '
                                                      'and McKinsey '
                                                      'Business Book of '
                                                      'the Year Award'},
                                            {'description': '',
                                             'extract': 'The 2007 Liberal '
                                                        'Democrats '
                                                        'leadership '
                                                        'election was '
                                                        'held following '
                                                        'the resignation '
                                                        'of Sir Menzies '
                                                        'Campbell as '
                                                        'leader on 15 '
                                                        'October 2007, '
                                                        'after 19 months '
                                                        'as leader of the '
                                                        'Liberal '
                                                        'Democrats, the '
                                                        'third-largest '
                                                        'political party '
                                                        'in the United '
                                                        'Kingdom.',
                                             'pageimage': 'Nick_Clegg_by_the_2009_budget_cropped.jpg',
                                             'title': 'Liberal Democrats '
                                                      'leadership '
                                                      'election, 2007'}],
                                'wv_recs': [{'description': '',
                                             'extract': 'Three Junes is '
                                                        "Julia Glass' "
                                                        'debut novel.',
                                             'pageimage': 'Three_Junes.jpg',
                                             'title': 'Three Junes'},
                                            {'description': '',
                                             'extract': 'The Turner House '
                                                        'is a 2015 debut '
                                                        'novel by Angela '
                                                        'Flournoy.',
                                             'pageimage': 'Antu_folder-camera.svg',
                                             'title': 'The Turner House'},
                                            {'description': '',
                                             'extract': 'The Hand that '
                                                        'First Held Mine '
                                                        'is a novel '
                                                        'written by '
                                                        'Maggie '
                                                        "O'Farrell, about "
                                                        'the first is the '
                                                        'spirited journey '
                                                        'of Lexie '
                                                        'Sinclair, a '
                                                        'bright, '
                                                        'tempestuous '
                                                        'woman who finds '
                                                        'her way from '
                                                        'rural Devon to '
                                                        'the center of '
                                                        "postwar London's "
                                                        'burgeoning art '
                                                        'scene.',
                                             'pageimage': "The_Hand_That_First_Held_Mine_(O'Farrell_novel).jpg",
                                             'title': 'The Hand That '
                                                      'First Held Mine'}]},
 'Don Perata': {'cs_recs': [{'description': '',
                             'extract': '"Special election musical '
                                        'chairs" is a term used by '
                                        'editorialists to describe a '
                                        'series of special elections '
                                        'triggered by the mid-term '
                                        'resignation or death of an '
                                        'officeholder, with elections '
                                        'being won by other '
                                        'officeholders, triggering '
                                        'further special elections until '
                                        'either the next election '
                                        'required to replace a vacant '
                                        'office is scheduled on a regular '
                                        'election day or the winner of an '
                                        'election does not create a '
                                        'vacancy in any elected office.',
                             'pageimage': 'Ron_Dellums.jpg',
                             'title': 'Special election musical chairs'},
                            {'description': 'American politician',
                             'extract': 'Wilma Chan (born October 5, 1949 '
                                        'in Boston, Massachusetts, '
                                        'Chinese: 陳煥瑛; pinyin: Chén '
                                        'Huànyīng) is a politician in '
                                        'California serving on the '
                                        'Alameda County Board of '
                                        'Supervisors.',
                             'pageimage': 'Antu_folder-camera.svg',
                             'title': 'Wilma Chan'},
                            {'description': '',
                             'extract': 'Proposition 11 of 2008 (or the '
                                        'Voters FIRST Act) was a law '
                                        'enacted by California voters '
                                        'that placed the power to draw '
                                        'electoral boundaries for State '
                                        'Assembly and State Senate '
                                        'districts in a Citizens '
                                        'Redistricting Commission, as '
                                        'opposed to the State Legislature.',
                             'pageimage': 'Seal_of_California.svg',
                             'title': 'California Proposition 11 (2008)'}],
                'wv_recs': [{'description': 'American politician',
                             'extract': 'Luis Alejo (born March 27, 1974) '
                                        'is an American politician who '
                                        'served in the California State '
                                        'Assembly representing the 30th '
                                        'Assembly District, encompassing '
                                        'the Pajaro and Salinas valleys.',
                             'pageimage': 'Luis_Alejo.jpg',
                             'title': 'Luis Alejo'},
                            {'description': '',
                             'extract': "California's 13th State Assembly "
                                        'district is one of 80 California '
                                        'State Assembly districts.',
                             'pageimage': 'California_AD-13_(2011).svg',
                             'title': "California's 13th State Assembly "
                                      'district'},
                            {'description': 'American politician',
                             'extract': 'Beth Burkhard Gaines (born '
                                        'September 17, 1959) is an '
                                        'American politician who served '
                                        'in the California State Assembly.',
                             'pageimage': 'Beth_Gaines.jpg',
                             'title': 'Beth Gaines'}]},
 'Francis Patrick Donovan': {'cs_recs': [{'description': '',
                                          'extract': 'The Ambassador and '
                                                     'Permanent '
                                                     'Representative of '
                                                     'Australia to the '
                                                     'World Trade '
                                                     'Organization is an '
                                                     'officer of the '
                                                     'Australian '
                                                     'Department of '
                                                     'Foreign Affairs and '
                                                     'Trade and the head '
                                                     'of the Permanent '
                                                     'Mission of the '
                                                     'Commonwealth of '
                                                     'Australia to the '
                                                     'World Trade '
                                                     'Organization (WTO) '
                                                     'in Geneva, '
                                                     'Switzerland.',
                                          'pageimage': 'Coat_of_Arms_of_Australia.svg',
                                          'title': 'Permanent '
                                                   'Representative of '
                                                   'Australia to the '
                                                   'World Trade '
                                                   'Organization'},
                                         {'description': 'Australian '
                                                         'diplomat',
                                          'extract': 'Damien Patrick '
                                                     'Miller is an '
                                                     'Australian career '
                                                     'diplomat and the '
                                                     'first Indigenous '
                                                     'Australian to head '
                                                     'an Australian '
                                                     'diplomatic mission.',
                                          'pageimage': 'Damien_Miller_(1).jpg',
                                          'title': 'Damien Miller'},
                                         {'description': '',
                                          'extract': 'Ivor Francis '
                                                     'Sutherland Vincent '
                                                     'CMG MBE (14 October '
                                                     '1912 – 5 May 1994) '
                                                     'was a British '
                                                     'diplomat and '
                                                     'co-founder of the '
                                                     'Andean Project.',
                                          'pageimage': 'Antu_folder-camera.svg',
                                          'title': 'Ivor Vincent'}],
                             'wv_recs': [{'description': 'British writer',
                                          'extract': 'Chantal Sophia '
                                                     '"Tessa" Dahl (born '
                                                     '11 April 1957) is '
                                                     'an English author '
                                                     'and former actress.',
                                          'pageimage': 'Antu_folder-camera.svg',
                                          'title': 'Tessa Dahl'},
                                         {'description': 'British '
                                                         'screenwriter',
                                          'extract': 'Lucy Neal Dahl '
                                                     '(born 4 August '
                                                     '1965) is a British '
                                                     'screenwriter and '
                                                     'daughter of Welsh '
                                                     'author Roald Dahl '
                                                     'and American '
                                                     'actress Patricia '
                                                     'Neal.',
                                          'pageimage': 'Lucy_Dahl_at_the_2016_Cannes_Film_Festival.jpg',
                                          'title': 'Lucy Dahl'},
                                         {'description': 'American '
                                                         'activist',
                                          'extract': 'Ophelia Magdalena '
                                                     'Dahl (born 12 May '
                                                     '1964) is a British '
                                                     'social justice and '
                                                     'health care '
                                                     'advocate.',
                                          'pageimage': 'Antu_folder-camera.svg',
                                          'title': 'Ophelia Dahl'}]},
 'Gary Rowett': {'cs_recs': [{'description': 'professional footballer',
                              'extract': 'Kevin Poole (born 21 July 1963) '
                                         'is an English former '
                                         'professional footballer who was '
                                         'until December 2016 the '
                                         'goalkeeping coach at Birmingham '
                                         'City.',
                              'pageimage': 'Kevin_Poole_April_2015.JPG',
                              'title': 'Kevin Poole'},
                             {'description': 'English footballer',
                              'extract': 'Mark David Sale (born 27 '
                                         'February 1972) is an English '
                                         'former professional footballer '
                                         'who played as a forward.',
                              'pageimage': 'Antu_folder-camera.svg',
                              'title': 'Mark Sale'},
                             {'description': 'professional footballer, '
                                             'coach',
                              'extract': 'Kevin Summerfield (born 7 '
                                         'January 1959) is an English '
                                         'football coach and retired '
                                         'player.',
                              'pageimage': 'Antu_folder-camera.svg',
                              'title': 'Kevin Summerfield'}],
                 'wv_recs': [{'description': 'English footballer and '
                                             'manager',
                              'extract': 'Lee David Johnson (born 7 June '
                                         '1981) is an English former '
                                         'professional footballer who is '
                                         'the manager of Championship '
                                         'club Bristol City.',
                              'pageimage': 'Lee_Johnson_27-08-2016_1.jpg',
                              'title': 'Lee Johnson (footballer)'},
                             {'description': 'footballer and manager',
                              'extract': 'Keith John Hill (born 17 May '
                                         '1969) is an English '
                                         'professional football manager '
                                         'and former footballer, who is '
                                         'the manager of League One club '
                                         'Rochdale.',
                              'pageimage': 'Keith_Hill.JPG',
                              'title': 'Keith Hill (footballer)'},
                             {'description': '',
                              'extract': 'Businessman Clifford Coombs '
                                         'took over as Birmingham '
                                         'chairman in 1965, and appointed '
                                         'Stan Cullis as manager.',
                              'pageimage': 'Trevor_Francis_1980_cropped.jpg',
                              'title': 'History of Birmingham City F.C. '
                                       '(1965–present)'}]},
 'Hartford railway station': {'cs_recs': [{'description': '',
                                           'extract': 'Greenbank railway '
                                                      'station serves the '
                                                      'village of '
                                                      'Hartford, Cheshire '
                                                      'as well as the '
                                                      'Greenbank and '
                                                      'Castle areas of '
                                                      'Northwich, '
                                                      'Cheshire, England.',
                                           'pageimage': 'Greenbank_railway_station_platforms_looking_towards_Manchester_in_2008.jpg',
                                           'title': 'Greenbank railway '
                                                    'station'},
                                          {'description': '',
                                           'extract': 'Middlewich railway '
                                                      'station served the '
                                                      'Cheshire, England, '
                                                      'salt-producing '
                                                      'town of Middlewich '
                                                      'between 1868 and '
                                                      '1960.',
                                           'pageimage': 'Antu_folder-camera.svg',
                                           'title': 'Middlewich railway '
                                                    'station'},
                                          {'description': '',
                                           'extract': 'Acton Bridge '
                                                      'railway station is '
                                                      'near the village '
                                                      'of Acton Bridge, '
                                                      'Cheshire, in the '
                                                      'northwest of '
                                                      'England.',
                                           'pageimage': 'ActonBridgeRailwayStation.jpg',
                                           'title': 'Acton Bridge railway '
                                                    'station'}],
                              'wv_recs': [{'description': '',
                                           'extract': 'Alfreton railway '
                                                      'station serves the '
                                                      'town of Alfreton '
                                                      'in Derbyshire, '
                                                      'England.',
                                           'pageimage': 'Alfreton_railway_station_in_2008.jpg',
                                           'title': 'Alfreton railway '
                                                    'station'},
                                          {'description': '',
                                           'extract': 'Helsby railway '
                                                      'station serves the '
                                                      'village of Helsby '
                                                      'in Cheshire, '
                                                      'England.',
                                           'pageimage': 'Helsby_railway_station_1.jpg',
                                           'title': 'Helsby railway '
                                                    'station'},
                                          {'description': '',
                                           'extract': 'The Dunstable '
                                                      'Branch Lines were '
                                                      'railway branch '
                                                      'lines that joined '
                                                      'the English town '
                                                      'of Dunstable to '
                                                      'the main lines at '
                                                      'Leighton Buzzard '
                                                      'and Welwyn.',
                                           'pageimage': 'Dunstable,_Dismantled_railway_and_National_Cycle_Network_Route_6_-_geograph.org.uk_-_146322.jpg',
                                           'title': 'Dunstable Branch '
                                                    'Lines'}]},
 'Isabel Fonseca': {'cs_recs': [{'description': '',
                                 'extract': 'Bury Me Standing: The '
                                            'Gypsies and Their Journey is '
                                            'a best-selling non-fiction '
                                            'book on the lives of the '
                                            'Romani people by the '
                                            'American-Uruguayan writer '
                                            'Isabel Fonseca published in '
                                            '1995.',
                                 'pageimage': 'Antu_folder-camera.svg',
                                 'title': 'Bury Me Standing: The Gypsies '
                                          'and Their Journey'},
                                {'description': 'American writer',
                                 'extract': 'Lily Tuck (born October 10, '
                                            '1938) is an American '
                                            'novelist and short story '
                                            'writer whose novel The News '
                                            'from Paraguay won the 2004 '
                                            'National Book Award for '
                                            'Fiction.',
                                 'pageimage': 'Antu_folder-camera.svg',
                                 'title': 'Lily Tuck'},
                                {'description': 'American poet',
                                 'extract': 'Mary Jo Salter (born August '
                                            '15, 1954) is an American '
                                            'poet, a co-editor of The '
                                            'Norton Anthology of Poetry '
                                            'and a professor in the '
                                            'Writing Seminars program at '
                                            'Johns Hopkins University.',
                                 'pageimage': 'Mary_jo_salter_6374.JPG',
                                 'title': 'Mary Jo Salter'}],
                    'wv_recs': [{'description': 'Welsh novelist',
                                 'extract': 'Martin Louis Amis (born 25 '
                                            'August 1949) is a British '
                                            'novelist.',
                                 'pageimage': 'Martin_amis_2014.jpg',
                                 'title': 'Martin Amis'},
                                {'description': 'novel by Martin Amis',
                                 'extract': 'The Pregnant Widow is a '
                                            'novel by the English writer '
                                            'Martin Amis, published by '
                                            'Jonathan Cape on 4 February '
                                            '2010.',
                                 'pageimage': 'The_Pregnant_Widow_by_Martin_Amis.JPG',
                                 'title': 'The Pregnant Widow'},
                                {'description': 'book by Martin Amis',
                                 'extract': 'Experience is a book of '
                                            'memoirs by the British '
                                            'author Martin Amis.',
                                 'pageimage': 'Experience_by_Martin_Amis.jpg',
                                 'title': 'Experience (Martin Amis)'}]},
 'Jack (Homes novel)': {'cs_recs': [{'description': '2004 American drama '
                                                    'TV film',
                                     'extract': 'Jack is a 2004 American '
                                                'drama TV film written by '
                                                'A. M. Homes and directed '
                                                'by Lee Rose.',
                                     'pageimage': 'Antu_folder-camera.svg',
                                     'title': 'Jack (2004 film)'},
                                    {'description': 'Wikimedia list '
                                                    'article',
                                     'extract': 'This is a list of '
                                                'characters in the '
                                                'California Diaries novel '
                                                'series by Ann M. Martin.',
                                     'pageimage': 'Antu_folder-camera.svg',
                                     'title': 'List of California Diaries '
                                              'characters'},
                                    {'description': '',
                                     'extract': 'The Coming Storm is a '
                                                '1999 novel by Paul '
                                                'Russell.',
                                     'pageimage': 'Coming-storm.jpg',
                                     'title': 'The Coming Storm'}],
                        'wv_recs': [{'description': 'novel by A. M. Homes',
                                     'extract': 'May We Be Forgiven is a '
                                                '2012 novel by American '
                                                'writer A. M. Homes.',
                                     'pageimage': 'May_We_Be_Forgiven_(novel).jpg',
                                     'title': 'May We Be Forgiven'},
                                    {'description': '',
                                     'extract': 'Empress of the World is '
                                                'a young adult novel by '
                                                'Sara Ryan.',
                                     'pageimage': 'Empress_of_the_World.jpg',
                                     'title': 'Empress of the World'},
                                    {'description': '',
                                     'extract': 'The Collected Stories of '
                                                'Jean Stafford is a short '
                                                'story collection by Jean '
                                                'Stafford.',
                                     'pageimage': 'JeanStaffordCollectedStories.JPG',
                                     'title': 'The Collected Stories of '
                                              'Jean Stafford'}]},
 'Kiss': {'cs_recs': [{'description': '',
                       'extract': 'Cheek kissing is a ritual or social '
                                  'kissing gesture to indicate '
                                  'friendship, perform a greeting, to '
                                  'confer congratulations, to comfort '
                                  'someone, to show respect, or to '
                                  'indicate sexual or romantic interest.',
                       'pageimage': 'Caravaggio_-_Taking_of_Christ_-_Dublin.jpg',
                       'title': 'Cheek kissing'},
                      {'description': '',
                       'extract': 'Many societies have traditions which '
                                  'involve kissing.',
                       'pageimage': 'Smooches_(baby_and_child_kiss).jpg',
                       'title': 'Kissing traditions'},
                      {'description': '',
                       'extract': 'An Eskimo kiss in modern Western '
                                  'culture is the act of pressing the tip '
                                  "of one's nose against another's.",
                       'pageimage': 'Eskimokiss.jpg',
                       'title': 'Eskimo kissing'}],
          'wv_recs': [{'description': '',
                       'extract': 'In English informal speech, a French '
                                  'kiss, also known as a deep kiss, is an '
                                  'amorous kiss in which the '
                                  "participants' tongues extend to touch "
                                  "each other's lips or tongue.",
                       'pageimage': 'French_Kiss.JPG',
                       'title': 'French kiss'},
                      {'description': 'sign of affection',
                       'extract': 'A hug is a form of physical intimacy, '
                                  'universal in human communities, in '
                                  'which two or more people put their '
                                  'arms around the neck, back, or waist '
                                  'of one another and hold each other '
                                  'closely.',
                       'pageimage': 'Wedding_hugs.jpg',
                       'title': 'Hug'},
                      {'description': 'set of emotionally and physically '
                                      'intimate acts between two or more '
                                      'people meant to create sexual '
                                      'arousal and desire for sexual '
                                      'activity',
                       'extract': 'In human sexual behavior, foreplay is '
                                  'a set of emotionally and physically '
                                  'intimate acts between two or more '
                                  'people meant to create sexual arousal '
                                  'and desire for sexual activity.',
                       'pageimage': 'Martin_van_Maele_-_Francion_15.jpg',
                       'title': 'Foreplay'}]},
 'List of serial killers before 1900': {'cs_recs': [{'description': '',
                                                     'extract': 'Necrophilia '
                                                                'is a '
                                                                'pathological '
                                                                'fascination '
                                                                'with '
                                                                'dead '
                                                                'bodies, '
                                                                'which '
                                                                'often '
                                                                'takes '
                                                                'the form '
                                                                'of a '
                                                                'desire '
                                                                'to '
                                                                'engage '
                                                                'with '
                                                                'them in '
                                                                'sexual '
                                                                'activities, '
                                                                'such as '
                                                                'intercourse.',
                                                     'pageimage': '19360903_-_Détective_-_François_Bertrand_01.jpg',
                                                     'title': 'Incidents '
                                                              'of '
                                                              'necrophilia'},
                                                    {'description': 'Wikimedia '
                                                                    'list '
                                                                    'article',
                                                     'extract': 'A serial '
                                                                'killer '
                                                                'is a '
                                                                'person '
                                                                'who '
                                                                'murders '
                                                                'three or '
                                                                'more '
                                                                'people, '
                                                                'in two '
                                                                'or more '
                                                                'separate '
                                                                'events '
                                                                'over a '
                                                                'period '
                                                                'of time, '
                                                                'for '
                                                                'primarily '
                                                                'psychological '
                                                                'reasons.',
                                                     'pageimage': 'Antu_folder-camera.svg',
                                                     'title': 'List of '
                                                              'serial '
                                                              'killers by '
                                                              'number of '
                                                              'victims'},
                                                    {'description': 'individual '
                                                                    'who '
                                                                    'has '
                                                                    'killed '
                                                                    'three '
                                                                    'or '
                                                                    'more '
                                                                    'people '
                                                                    'over '
                                                                    'a '
                                                                    'period '
                                                                    'of '
                                                                    'more '
                                                                    'than '
                                                                    'a '
                                                                    'month',
                                                     'extract': 'A serial '
                                                                'killer '
                                                                'is a '
                                                                'person '
                                                                'who '
                                                                'typically '
                                                                'murders '
                                                                'three or '
                                                                'more '
                                                                'people, '
                                                                'usually '
                                                                'in '
                                                                'service '
                                                                'of '
                                                                'abnormal '
                                                                'psychological '
                                                                'gratification, '
                                                                'with the '
                                                                'murders '
                                                                'taking '
                                                                'place '
                                                                'over '
                                                                'more '
                                                                'than a '
                                                                'month '
                                                                'and '
                                                                'including '
                                                                'a '
                                                                'significant '
                                                                'break (a '
                                                                '"cooling '
                                                                'off '
                                                                'period") '
                                                                'between '
                                                                'them.',
                                                     'pageimage': 'Ottis_Toole.jpg',
                                                     'title': 'Serial '
                                                              'killer'}],
                                        'wv_recs': [{'description': '5th '
                                                                    'Century '
                                                                    'serial '
                                                                    'killer '
                                                                    'from '
                                                                    'Yemen',
                                                     'extract': 'Zu '
                                                                'Shenatir '
                                                                '(fl.',
                                                     'pageimage': 'Antu_folder-camera.svg',
                                                     'title': 'Zu Shenatir'},
                                                    {'description': 'Scottish '
                                                                    'criminal',
                                                     'extract': 'Geordie '
                                                                'Bourne '
                                                                '(or '
                                                                'Burn) '
                                                                '(died '
                                                                '1597) '
                                                                'was a '
                                                                'well-known '
                                                                'thief or '
                                                                'raider '
                                                                'in the '
                                                                'English '
                                                                'East '
                                                                'Marches '
                                                                'land '
                                                                'that '
                                                                'bordered '
                                                                'Scotland.',
                                                     'pageimage': 'Antu_folder-camera.svg',
                                                     'title': 'Geordie '
                                                              'Bourne'},
                                                    {'description': 'Han '
                                                                    'Dynasty '
                                                                    'prince, '
                                                                    'serial '
                                                                    'killer',
                                                     'extract': 'Liu '
                                                                'Pengli '
                                                                '(Chinese: '
                                                                '劉彭離), '
                                                                'Prince '
                                                                'of '
                                                                'Jidong '
                                                                '(濟東王), '
                                                                'was a '
                                                                '2nd-century '
                                                                'BC Han '
                                                                'prince.',
                                                     'pageimage': 'Antu_folder-camera.svg',
                                                     'title': 'Liu Pengli'}]},
 'Murder of Kelly Anne Bates': {'cs_recs': [{'description': '',
                                             'extract': 'The murder of '
                                                        'Suzanne Capper '
                                                        'was committed in '
                                                        'Greater '
                                                        'Manchester, '
                                                        'England in '
                                                        'December 1992.',
                                             'pageimage': 'Suzanne_Capper.png',
                                             'title': 'Murder of Suzanne '
                                                      'Capper'},
                                            {'description': '',
                                             'extract': 'The murder of '
                                                        'Tia Rigg (4 '
                                                        'January 1998 – 3 '
                                                        'April 2010) was '
                                                        'committed in '
                                                        'Cheetham Hill, '
                                                        'Manchester, '
                                                        'England, on 3 '
                                                        'April 2010.',
                                             'pageimage': 'Tia_Rigg.png',
                                             'title': 'Murder of Tia Rigg'},
                                            {'description': '',
                                             'extract': 'Yaseen Ege was a '
                                                        'seven-year-old '
                                                        'Asian Muslim boy '
                                                        'killed by his '
                                                        'mother, Sara '
                                                        'Ege, at their '
                                                        'home in Cardiff, '
                                                        'in the United '
                                                        'Kingdom, in July '
                                                        '2010, for '
                                                        'failing to '
                                                        'memorise the '
                                                        'Quran.',
                                             'pageimage': 'Antu_folder-camera.svg',
                                             'title': 'Murder of Yaseen '
                                                      'Ege'}],
                                'wv_recs': [{'description': '',
                                             'extract': 'Jennifer Lee '
                                                        'Daugherty '
                                                        '(November 8, '
                                                        '1979 – February '
                                                        '11, 2010) was an '
                                                        'American woman '
                                                        'who was murdered '
                                                        'in Greensburg, '
                                                        'Pennsylvania in '
                                                        'February 2010.',
                                             'pageimage': 'Antu_folder-camera.svg',
                                             'title': 'Murder of Jennifer '
                                                      'Daugherty'},
                                            {'description': '',
                                             'extract': 'Skylar Annette '
                                                        'Neese (February '
                                                        '10, 1996 – July '
                                                        '6, 2012) was an '
                                                        'American girl '
                                                        'who disappeared '
                                                        'from her home in '
                                                        'Star City, West '
                                                        'Virginia around '
                                                        'midnight on July '
                                                        '6, 2012.',
                                             'pageimage': 'Skylar_Neese.jpg',
                                             'title': 'Murder of Skylar '
                                                      'Neese'},
                                            {'description': '',
                                             'extract': 'Torture murder '
                                                        'is a loosely '
                                                        'defined term to '
                                                        'describe a '
                                                        'murder where '
                                                        'death has been '
                                                        'preceded by the '
                                                        'torture of the '
                                                        'victim.',
                                             'pageimage': 'Antu_folder-camera.svg',
                                             'title': 'Torture murder'}]},
 'Nicole Moudaber': {'cs_recs': [{'description': '',
                                  'extract': 'DJ Awards is a nonprofit '
                                             'organization which '
                                             'organizes the annual '
                                             'electronic music DJ Awards '
                                             'event, which is the only '
                                             'international ceremony that '
                                             'solely awards DJs and also '
                                             'the oldest.',
                                  'pageimage': 'Kryptonite.png',
                                  'title': 'DJ Awards'},
                                 {'description': 'DJ',
                                  'extract': 'Uroš Umek (Slovene '
                                             'pronunciation: [ˈúːrɔʃ '
                                             'ˈúːmək]; born May 16, 1976 '
                                             'in Ljubljana, Slovenia), '
                                             'better known as DJ Umek or '
                                             'simply Umek, is a Slovenian '
                                             'dance music composer and '
                                             'DJ. Musically active since '
                                             '1993, he is the owner of '
                                             'several techno record '
                                             'labels.',
                                  'pageimage': 'Antu_folder-camera.svg',
                                  'title': 'DJ Umek'},
                                 {'description': 'Slovenian musician',
                                  'extract': 'Tine Kocjančič, better '
                                             'known as Valentino Kanzyani '
                                             'is a Slovenian techno '
                                             'deejay and music producer.',
                                  'pageimage': 'Antu_folder-camera.svg',
                                  'title': 'Valentino Kanzyani'}],
                     'wv_recs': [{'description': 'American disc jockey '
                                                 'and musician',
                                  'extract': "Kerri 'Kaoz' Chandler (born "
                                             '28 September), is an '
                                             'electronic music producer '
                                             'and DJ concerning Deep '
                                             'house and Future house '
                                             'music.',
                                  'pageimage': 'Antu_folder-camera.svg',
                                  'title': 'Kerri Chandler'},
                                 {'description': '',
                                  'extract': 'Intec Digital is a record '
                                             'company rediscovered after '
                                             'four years of inactivity on '
                                             'the ground of Intec Records.',
                                  'pageimage': 'Antu_folder-camera.svg',
                                  'title': 'Intec Digital'},
                                 {'description': 'American record producer',
                                  'extract': 'Seth Troxler is an American '
                                             'DJ, producer from Lake '
                                             'Orion, Michigan.',
                                  'pageimage': 'Seth_Troxler,_Mint.jpg',
                                  'title': 'Seth Troxler'}]},
 'Opernpassage': {'cs_recs': [{'description': 'Austrian architect',
                               'extract': 'Adolf Hoch (June 17, 1910 – '
                                          'May 24, 1992) was an Austrian '
                                          'architect.',
                               'pageimage': 'Opernpassage_Panorama.jpg',
                               'title': 'Adolf Hoch'},
                              {'description': '3rd municipal District of '
                                              'Vienna, Austria',
                               'extract': 'Landstraße (German '
                                          'pronunciation: '
                                          '[ˈlantˌʃtʀaːsə]) is the 3rd '
                                          'municipal District of Vienna, '
                                          'Austria (German: 3.',
                               'pageimage': 'Kartewien3.png',
                               'title': 'Landstraße'},
                              {'description': 'Steffl Department Store '
                                              'Vienna',
                               'extract': 'Steffl Department Store Vienna '
                                          '(abbreviated as: Steffl) is a '
                                          'department store located at '
                                          'Kärntner Strasse 19 in the '
                                          'First District of Vienna Inner '
                                          'City.',
                               'pageimage': 'Department-store-steffl.jpg',
                               'title': 'Steffl Department Store Vienna'}],
                  'wv_recs': [{'description': 'metro station in Vienna, '
                                              'Austria',
                               'extract': 'Meidling Hauptstraße is a '
                                          'station on Line U4 of the '
                                          'Vienna U-Bahn.',
                               'pageimage': 'Meidling_Hauptstraße1.JPG',
                               'title': 'Meidling Hauptstraße (Vienna '
                                        'U-Bahn)'},
                              {'description': 'metro station in Vienna, '
                                              'Austria',
                               'extract': 'Donauinsel is a station on '
                                          'Line U1 of the Vienna U-Bahn.',
                               'pageimage': 'U1_Donauinsel4.JPG',
                               'title': 'Donauinsel (Vienna U-Bahn)'},
                              {'description': 'metro station in Vienna, '
                                              'Austria',
                               'extract': 'Währinger Straße-Volksoper is '
                                          'a station on Line U6 of the '
                                          'Vienna U-Bahn.',
                               'pageimage': 'U6_Währinger_Straße7.JPG',
                               'title': 'Währinger Straße-Volksoper '
                                        '(Vienna U-Bahn)'}]},
 'Revolution Muslim': {'cs_recs': [{'description': 'American man who '
                                                   'aided Al-Shabaab, a '
                                                   'terrorist organization',
                                    'extract': 'Zachary Adam Chesser '
                                               '(born December 22, 1989) '
                                               'is an American convicted '
                                               'in 2010 for aiding '
                                               'al-Shabaab, which is '
                                               'aligned with al-Qaeda, '
                                               'and has been designated a '
                                               'terrorist organization by '
                                               'the U.S. government.',
                                    'pageimage': 'Zachary_Chesser_mug_shot.jpg',
                                    'title': 'Zachary Adam Chesser'},
                                   {'description': '',
                                    'extract': 'Jihadist extremism in the '
                                               'United States (or '
                                               'Islamist extremism in the '
                                               'United States) refers to '
                                               'Islamic extremism '
                                               'occurring within the '
                                               'United States.',
                                    'pageimage': 'September_17_2001_Ground_Zero_01.jpg',
                                    'title': 'Jihadist extremism in the '
                                             'United States'},
                                   {'description': 'Alleged Al-qaeda '
                                                   'terrorist',
                                    'extract': 'Mohammed Wali Zazi (born '
                                               '1955 in Afghanistan), '
                                               'currently a naturalized '
                                               'U.S. citizen residing in '
                                               'Arapahoe County, '
                                               'Colorado, is a suspect in '
                                               'matters related to '
                                               'terrorism.',
                                    'pageimage': 'Antu_folder-camera.svg',
                                    'title': 'Mohammed Wali Zazi'}],
                       'wv_recs': [{'description': '',
                                    'extract': 'The Islamic Thinkers '
                                               'Society is a Muslim group '
                                               'based in New York City '
                                               'that seeks the goal of '
                                               'restoring the Islamic '
                                               'Caliphate to create what '
                                               'it calls "an ideal '
                                               'Islamic society." Its '
                                               'members are located '
                                               'mainly in Jackson '
                                               'Heights, Queens, New York '
                                               'City, United States.',
                                    'pageimage': 'Antu_folder-camera.svg',
                                    'title': 'Islamic Thinkers Society'},
                                   {'description': '',
                                    'extract': 'South Park is an American '
                                               'animated sitcom created '
                                               'by Trey Parker and Matt '
                                               'Stone.',
                                    'pageimage': 'South_park_muhammad.jpg',
                                    'title': 'South Park controversies'},
                                   {'description': 'American terrorism '
                                                   'expert',
                                    'extract': 'Jarret Brachman is an '
                                               'American terrorism '
                                               'expert, the author of '
                                               'Global Jihadism: Theory '
                                               'and Practice and a '
                                               'consultant to several '
                                               'government agencies about '
                                               'terrorism.',
                                    'pageimage': 'Antu_folder-camera.svg',
                                    'title': 'Jarret Brachman'}]},
 "Tell The Wolves I'm Home": {'cs_recs': [{'description': 'fictional human',
                                           'extract': 'Bridget "Bee" '
                                                      'Vreeland is a main '
                                                      'character in the '
                                                      '2001 novel The '
                                                      'Sisterhood of the '
                                                      'Traveling Pants.',
                                           'pageimage': 'Blake_Lively_2011_Shankbone_2.JPG',
                                           'title': 'Bridget Vreeland'},
                                          {'description': '',
                                           'extract': 'Switched is the '
                                                      'first book of the '
                                                      'young adult '
                                                      'paranormal '
                                                      'literature series '
                                                      'the Trylle Trilogy.',
                                           'pageimage': 'Switchedbookcover.jpg',
                                           'title': 'Switched (Hocking '
                                                    'novel)'},
                                          {'description': '1979 film by '
                                                          'Michael '
                                                          'Pressman',
                                           'extract': 'Boulevard Nights '
                                                      'is a 1979 film '
                                                      'directed by '
                                                      'Michael Pressman.',
                                           'pageimage': 'Boulevard_Nights.jpg',
                                           'title': 'Boulevard Nights'}],
                              'wv_recs': [{'description': '',
                                           'extract': 'The Night Circus '
                                                      'is a 2011 fantasy '
                                                      'novel by Erin '
                                                      'Morgenstern.',
                                           'pageimage': 'TheNightCircus.jpg',
                                           'title': 'The Night Circus'},
                                          {'description': '',
                                           'extract': 'Everything I Never '
                                                      'Told You is a 2014 '
                                                      'debut novel by '
                                                      'Celeste Ng.',
                                           'pageimage': 'Celeste_Ng_-_Everything_I_Never_Told_You.png',
                                           'title': 'Everything I Never '
                                                    'Told You'},
                                          {'description': '',
                                           'extract': 'Side Effects May '
                                                      'Vary is a 2014 '
                                                      'young adult novel '
                                                      'and the literary '
                                                      'debut of Julie '
                                                      'Murphy.',
                                           'pageimage': 'Antu_folder-camera.svg',
                                           'title': 'Side Effects May Vary'}]},
 'The Queen of the Tearling': {'cs_recs': [{'description': 'English film '
                                                           'producer',
                                            'extract': 'David Jonathan '
                                                       'Heyman (born 26 '
                                                       'July 1961) is an '
                                                       'English film '
                                                       'producer and the '
                                                       'founder of Heyday '
                                                       'Films.',
                                            'pageimage': 'David_Heyman1.jpg',
                                            'title': 'David Heyman'},
                                           {'description': 'English '
                                                           'actress and '
                                                           'model',
                                            'extract': 'Emma Charlotte '
                                                       'Duerre Watson '
                                                       '(born 15 April '
                                                       '1990) is a '
                                                       'British actress, '
                                                       'model, and '
                                                       'activist.',
                                            'pageimage': 'Emma_Watson_2013.jpg',
                                            'title': 'Emma Watson'},
                                           {'description': '',
                                            'extract': 'Harry Potter and '
                                                       'the Deathly '
                                                       'Hallows is the '
                                                       '2010/2011 '
                                                       'two-part finale '
                                                       'of the Harry '
                                                       'Potter film '
                                                       'series.',
                                            'pageimage': 'HP7part1+2poster.jpg',
                                            'title': 'Production of Harry '
                                                     'Potter and the '
                                                     'Deathly Hallows'}],
                               'wv_recs': [{'description': '',
                                            'extract': 'Sarah Janet Maas '
                                                       '(born 5 March '
                                                       '1986) is a New '
                                                       'York Times and '
                                                       'USA Today '
                                                       'bestselling '
                                                       'American fantasy '
                                                       'author.',
                                            'pageimage': 'Antu_folder-camera.svg',
                                            'title': 'Sarah J. Maas'},
                                           {'description': '',
                                            'extract': 'Throne of Glass '
                                                       'is a young adult '
                                                       'high fantasy '
                                                       'novel series by '
                                                       'American author '
                                                       'Sarah J. Maas, '
                                                       'beginning with '
                                                       'the inaugural '
                                                       'entry of the same '
                                                       'name.',
                                            'pageimage': 'Throne_of_Glass_UK.jpg',
                                            'title': 'Throne of Glass'},
                                           {'description': '',
                                            'extract': 'Short Stories '
                                                       'from Hogwarts of '
                                                       'Heroism, Hardship '
                                                       'and Dangerous '
                                                       'Hobbies is an '
                                                       'e-book written by '
                                                       'J. K. Rowling, a '
                                                       'guide to '
                                                       "Hogwarts' "
                                                       'teachers.',
                                            'pageimage': 'Rowling_-_Short_Stories_from_Hogwarts_of_Heroism,_Hardship_and_Dangerous_Hobbies_coverart.png',
                                            'title': 'Short Stories from '
                                                     'Hogwarts of '
                                                     'Heroism, Hardship '
                                                     'and Dangerous '
                                                     'Hobbies'}]},
 'Thomas Meehan (writer)': {'cs_recs': [{'description': '',
                                         'extract': 'Rocky the Musical '
                                                    '(originally Rocky: '
                                                    'Das Musical) is a '
                                                    '2012 musical with '
                                                    'music and lyrics by '
                                                    'Stephen Flaherty and '
                                                    'Lynn Ahrens, with a '
                                                    'book by Thomas '
                                                    'Meehan, adapted from '
                                                    'a screenplay by '
                                                    'Sylvester Stallone.',
                                         'pageimage': 'Rocky_the_Musical.jpg',
                                         'title': 'Rocky the Musical'},
                                        {'description': 'musical based on '
                                                        'the John Waters '
                                                        'movie of the '
                                                        'same name',
                                         'extract': 'Cry-Baby is a '
                                                    'musical based on the '
                                                    '1990 John Waters '
                                                    'film of the same '
                                                    'name.',
                                         'pageimage': 'Cry-Baby.jpg',
                                         'title': 'Cry-Baby (musical)'},
                                        {'description': '',
                                         'extract': 'Elf is a musical '
                                                    'based on the motion '
                                                    'picture of the same '
                                                    'name, with a score '
                                                    'by Matthew Sklar and '
                                                    'Chad Beguelin.',
                                         'pageimage': 'Elfthemusical.jpg',
                                         'title': 'Elf: The Musical'}],
                            'wv_recs': [{'description': 'American dancer',
                                         'extract': 'Wayne Louis Cilento '
                                                    '(born August 28, '
                                                    '1949) is an American '
                                                    'director and '
                                                    'choreographer.',
                                         'pageimage': 'Antu_folder-camera.svg',
                                         'title': 'Wayne Cilento'},
                                        {'description': '',
                                         'extract': 'Forbidden Broadway '
                                                    'Goes to Rehab is the '
                                                    '2008 incarnation of '
                                                    'Gerard '
                                                    "Alessandrini's "
                                                    'long-running hit '
                                                    'Off-Broadway musical '
                                                    'revue Forbidden '
                                                    'Broadway, which '
                                                    'parodies notable '
                                                    'current Broadway and '
                                                    'Off Broadway '
                                                    'musicals.',
                                         'pageimage': 'Antu_folder-camera.svg',
                                         'title': 'Forbidden Broadway '
                                                  'Goes to Rehab'},
                                        {'description': '',
                                         'extract': 'The Drama Desk Award '
                                                    'for Outstanding '
                                                    'Actor in a Musical '
                                                    'is an annual award '
                                                    'presented by Drama '
                                                    'Desk in recognition '
                                                    'of achievements in '
                                                    'the theatre among '
                                                    'Broadway, Off '
                                                    'Broadway and Off-Off '
                                                    'Broadway productions.',
                                         'pageimage': 'Antu_folder-camera.svg',
                                         'title': 'Drama Desk Award for '
                                                  'Outstanding Actor in a '
                                                  'Musical'}]},
 'Uttar Pradesh': {'cs_recs': [{'description': 'Wikimedia list article',
                                'extract': 'The Indian state of Uttar '
                                           'Pradesh borders with Nepal '
                                           'and the Indian states of '
                                           'Bihar, Jharkhand, '
                                           'Chhattisgarh, Madhya Pradesh, '
                                           'Rajasthan, Haryana, '
                                           'Uttarakhand and National '
                                           'Capital Territory of Delhi.',
                                'pageimage': 'India_Uttar_Pradesh_location_map.svg',
                                'title': 'List of cities in Uttar Pradesh '
                                         'by population'},
                               {'description': 'Wikimedia list article',
                                'extract': 'This is an incomplete list of '
                                           'institutions of higher '
                                           'education in the state of '
                                           'Uttar Pradesh, India.',
                                'pageimage': 'Kennedy_House.jpg',
                                'title': 'List of institutions of higher '
                                         'education in Uttar Pradesh'},
                               {'description': '',
                                'extract': 'The economy of Uttar Pradesh '
                                           'is the third largest economy '
                                           'in India after Maharashtra '
                                           'and Tamil Nadu.',
                                'pageimage': 'Antu_folder-camera.svg',
                                'title': 'Economy of Uttar Pradesh'}],
                   'wv_recs': [{'description': 'Wikimedia list article',
                                'extract': '',
                                'pageimage': 'India_UP.svg',
                                'title': 'List of districts of Uttar '
                                         'Pradesh'},
                               {'description': 'division of Uttar '
                                               'Pradesh, India',
                                'extract': 'Allahabad division is an '
                                           'administrative unit of Indian '
                                           'state of Uttar Pradesh.',
                                'pageimage': 'Allahabad_division.svg',
                                'title': 'Allahabad division'},
                               {'description': 'district of Uttar '
                                               'Pradesh, India',
                                'extract': 'Allahabad District is one of '
                                           'the major & largest districts '
                                           'of Uttar Pradesh state of '
                                           'India, and Allahabad city is '
                                           'the district headquarters.',
                                'pageimage': 'India_Uttar_Pradesh_districts_2012_Allahabad.svg',
                                'title': 'Allahabad district'}]},
 'Will Self': {'cs_recs': [{'description': '',
                            'extract': 'Zack Busner is a recurring '
                                       'character in the fiction of '
                                       'British author Will Self, '
                                       'appearing in the short story '
                                       'collections The Quantity Theory '
                                       'of Insanity, Grey Area, Dr.',
                            'pageimage': 'Antu_folder-camera.svg',
                            'title': 'Zack Busner'},
                           {'description': '',
                            'extract': 'The Quantity Theory of Insanity '
                                       'is a collection of short stories '
                                       'by Will Self.',
                            'pageimage': 'QTOI.jpg',
                            'title': 'The Quantity Theory of Insanity'},
                           {'description': 'British writer',
                            'extract': 'Dame Hilary Mary Mantel, DBE FRSL '
                                       '(/mænˈtɛl/ man-TEL; born '
                                       'Thompson, 6 July 1952), is an '
                                       'English writer whose work '
                                       'includes personal memoirs, short '
                                       'stories, and historical fiction.',
                            'pageimage': 'Antu_folder-camera.svg',
                            'title': 'Hilary Mantel'}],
               'wv_recs': [{'description': 'British journalist',
                            'extract': 'Jonathan Self (born 1959) is a '
                                       'British author and journalist.',
                            'pageimage': 'Antu_folder-camera.svg',
                            'title': 'Jonathan Self'},
                           {'description': '',
                            'extract': 'The Unbearable Lightness of Being '
                                       'a Prawn Cracker is a collection '
                                       "of Will Self's Real Meals column "
                                       'for the New Statesman.',
                            'pageimage': 'The_Unbearable_Lightness_of_Being_A_Prawn_Cracker_Book_Cover.jpg',
                            'title': 'The Unbearable Lightness of Being a '
                                     'Prawn Cracker'},
                           {'description': 'British journalist',
                            'extract': 'Deborah Jane Orr (born 23 '
                                       'September 1962) is a Scottish '
                                       'journalist who has worked for The '
                                       'Guardian and other titles.',
                            'pageimage': 'Antu_folder-camera.svg',
                            'title': 'Deborah Orr'}]},
 'Yazoo and Mississippi Valley Railroad': {'cs_recs': [{'description': '',
                                                        'extract': 'The '
                                                                   'Yazoo-Delta '
                                                                   'Railroad '
                                                                   '(sometimes '
                                                                   'known '
                                                                   'as '
                                                                   'the '
                                                                   'Yellow '
                                                                   'Dog) '
                                                                   'was a '
                                                                   'branch '
                                                                   'line '
                                                                   'that '
                                                                   'opened '
                                                                   'in '
                                                                   'August '
                                                                   '1897 '
                                                                   'between '
                                                                   'Moorhead '
                                                                   'and '
                                                                   'Ruleville, '
                                                                   'Mississippi.',
                                                        'pageimage': 'Antu_folder-camera.svg',
                                                        'title': 'Yazoo '
                                                                 'Delta '
                                                                 'Railroad'},
                                                       {'description': '',
                                                        'extract': 'Rosedale '
                                                                   'is a '
                                                                   'city '
                                                                   'in '
                                                                   'Bolivar '
                                                                   'County, '
                                                                   'Mississippi, '
                                                                   'United '
                                                                   'States.',
                                                        'pageimage': 'Bolivar_County_Mississippi_Incorporated_and_Unincorporated_areas_Rosedale_Highlighted.svg',
                                                        'title': 'Rosedale, '
                                                                 'Mississippi'},
                                                       {'description': 'Amtrak '
                                                                       'rail '
                                                                       'service '
                                                                       'between '
                                                                       'Chicago '
                                                                       'and '
                                                                       'New '
                                                                       'Orleans',
                                                        'extract': 'The '
                                                                   'City '
                                                                   'of '
                                                                   'New '
                                                                   'Orleans '
                                                                   'is an '
                                                                   'Amtrak '
                                                                   'passenger '
                                                                   'train '
                                                                   'which '
                                                                   'operates '
                                                                   'on an '
                                                                   'overnight '
                                                                   'schedule '
                                                                   'between '
                                                                   'Chicago, '
                                                                   'Illinois, '
                                                                   'and '
                                                                   'New '
                                                                   'Orleans, '
                                                                   'Louisiana.',
                                                        'pageimage': 'CityofNewOrleansPin.jpg',
                                                        'title': 'City of '
                                                                 'New '
                                                                 'Orleans '
                                                                 '(train)'}],
                                           'wv_recs': [{'description': '',
                                                        'extract': 'Mississippi '
                                                                   'Central '
                                                                   'Railroad '
                                                                   '(reporting '
                                                                   'mark '
                                                                   'MSCI) '
                                                                   'is a '
                                                                   'short '
                                                                   'line '
                                                                   'railroad '
                                                                   'operating '
                                                                   'over '
                                                                   '51 '
                                                                   'miles '
                                                                   'from '
                                                                   'Oxford, '
                                                                   'Mississippi '
                                                                   'to '
                                                                   'Grand '
                                                                   'Junction, '
                                                                   'Tennessee '
                                                                   'owned '
                                                                   'by '
                                                                   'Pioneer '
                                                                   'Railcorp.',
                                                        'pageimage': 'MSCI_1605.jpg',
                                                        'title': 'Mississippi '
                                                                 'Central '
                                                                 'Railroad'},
                                                       {'description': 'defunct '
                                                                       'railroad '
                                                                       'in '
                                                                       'the '
                                                                       'Southern '
                                                                       'U.S.',
                                                        'extract': 'The '
                                                                   'Mobile '
                                                                   'and '
                                                                   'Ohio '
                                                                   'Railroad '
                                                                   'was a '
                                                                   'railroad '
                                                                   'in '
                                                                   'the '
                                                                   'Southern '
                                                                   'U.S. '
                                                                   'The '
                                                                   'M&O '
                                                                   'was '
                                                                   'chartered '
                                                                   'in '
                                                                   'January '
                                                                   'and '
                                                                   'February '
                                                                   '1848 '
                                                                   'by '
                                                                   'the '
                                                                   'states '
                                                                   'of '
                                                                   'Alabama, '
                                                                   'Kentucky, '
                                                                   'Mississippi, '
                                                                   'and '
                                                                   'Tennessee.',
                                                        'pageimage': "1903_Poor's_Mobile_and_Ohio_Railroad.jpg",
                                                        'title': 'Mobile '
                                                                 'and '
                                                                 'Ohio '
                                                                 'Railroad'},
                                                       {'description': 'unincoporated '
                                                                       'community '
                                                                       'in '
                                                                       'Bolivar '
                                                                       'County, '
                                                                       'Mississippi',
                                                        'extract': 'Scott '
                                                                   'is an '
                                                                   'unincorporated '
                                                                   'community '
                                                                   'located '
                                                                   'in '
                                                                   'Bolivar '
                                                                   'County, '
                                                                   'Mississippi, '
                                                                   'United '
                                                                   'States '
                                                                   'on '
                                                                   'Mississippi '
                                                                   'Highway '
                                                                   '1.',
                                                        'pageimage': 'ScottMississippiSign.jpg',
                                                        'title': 'Scott, '
                                                                 'Mississippi'}]}}

Winnow the article content

Only keep the 24 articles for which we have recs

ar_content = {k:v for k,v in article_content.items() if k in wv_recs.keys()}
pprint(ar_content)
{'2016 Los Angeles Kiss season': ['',
                                  'The 2016 Los Angeles Kiss season was the '
                                  'third and final season for the arena '
                                  'football franchise in the Arena Football '
                                  'League. The team was coached by Omarr '
                                  'Smith and played their home games at '
                                  'Honda Center.',
                                  ['Standings',
                                   'Schedule',
                                   'Roster',
                                   'References']],
 'A Summer Bird-Cage': ['ASummerBirdCage.jpg',
                        'A Summer Bird-Cage is the 1963 debut novel by '
                        'Margaret Drabble published by Weidenfeld & '
                        'Nicolson.',
                        ['Content', 'References']],
 'Amanda Green': ['',
                  'Amanda Green (born December 29, 1963) is an American '
                  'actress, singer and songwriter.',
                  ['Early life',
                   'Career',
                   'Personal life',
                   'See also',
                   'References',
                   'External links']],
 'Andrew Michael Hurley': ['',
                           'Andrew Michael Hurley (born 1975) is a British '
                           'writer whose debut novel, The Loney, was '
                           'published in a limited edition of 300 copies in '
                           '2014 by Tartarus Press and was published under '
                           "Hodder and Stoughton's John Murray imprint in "
                           '2015 (ISBN 9781473619821). He was interviewed '
                           'on BBC Radio 4\'s Open Book programme "British '
                           'Gothic" in October 2015.\n'
                           'The Loney has been reviewed in The Guardian and '
                           'The Telegraph. It is set in the area of '
                           'Morecambe Bay in north west England, described '
                           'in the text as "that strange nowhere between '
                           'the Wyre and the Lune". Hurley has said that '
                           'the novel\'s two starting points were "to write '
                           'a kind of dark version of the Nativity [...] '
                           'and exploring ideas of faith and belief" and '
                           '"various wild, lonely places on the north west '
                           'coast of Lancashire [...] a sense of imminent '
                           'menace or dormant power lying just under the '
                           'sand and the water".',
                           ['References', 'External links']],
 'Cathy Marie Buchanan': ['',
                          'Cathy Marie Buchanan is a Toronto-based writer. '
                          'The Day the Falls Stood Still, her debut novel, '
                          'was published in North America in 2009 and Italy '
                          'and the UK in 2010. It immediately became a New '
                          'York Times bestseller. The novel was chosen as a '
                          'Barnes & Noble Recommends selection, a Barnes & '
                          'Noble Best of 2009 book, an American Booksellers '
                          'Association Indie Next pick and a CBC Canada '
                          'Reads Top 40 Essential Canadian Novel of the '
                          "Decade. Inspired by the life of Niagara's most "
                          'famous riverman, William "Red" Hill, the novel '
                          'chronicles early hydroelectric development on '
                          'the Niagara River.',
                          ['References', 'External links']],
 'Did You Ever Have a Family': ['',
                                'Did You Ever Have a Family is the debut '
                                'novel by American literary agent and '
                                'author Bill Clegg, published in 2015.',
                                ['Plot summary',
                                 'Characters',
                                 'Reception',
                                 'Recognition',
                                 'References']],
 'Don Perata': ['',
                'Don Richard Perata (born April 30, 1945) is a California '
                'Democratic politician, who was President pro tempore of '
                'the California State Senate from 2004 to 2008. He came in '
                'second place in the November 2010 ballot for Mayor of '
                'Oakland.',
                ['Background',
                 'Alameda County politics',
                 'Rise to the California State Senate',
                 'California State Senate',
                 'Post-Senate',
                 'Political controversy',
                 'References',
                 'External links',
                 'Offices held']],
 'Francis Patrick Donovan': ['Francis_Patrick_Donovan,_Australian_Diplomat,_1977.jpg',
                             'Francis Patrick Donovan, AM (1 February 1922 '
                             '− 3 February 2012) was Australian Ambassador '
                             'and Permanent Representative to the OECD, and '
                             'Ambassador and Special Trade Delegate to the '
                             'United Nations Office at Geneva. After '
                             'retirement from the Diplomatic Service, he '
                             'became a Vice-Chairman of the International '
                             'Court of Arbitration.',
                             ['Early life',
                              'Educational career',
                              'Diplomatic career',
                              'Later life and death',
                              'Awards and decorations',
                              'References']],
 'Gary Rowett': ['Gary_Rowett.jpg',
                 'Gary Rowett (born 6 March 1974) is an English '
                 'professional football manager and former player. He was '
                 'appointed manager of Birmingham City in October 2014 and '
                 'served until December 2016.\n'
                 'As a player he was a defender, and played in the Premier '
                 'League for Everton, Derby County, Leicester City and '
                 'Charlton Athletic. He also played in the Football League '
                 'for Cambridge United, Blackpool, Birmingham City and '
                 'Burton Albion. In May 2009 he was appointed assistant '
                 'manager to Paul Peschisolido at Burton, and took over as '
                 'manager in 2012.',
                 ['Playing career',
                  'Management career',
                  'Media career',
                  'Managerial statistics',
                  'References',
                  'External links']],
 'Hartford railway station': ['Hartford_railway_station,_Cheshire_(5).JPG',
                              'Hartford railway station is in the village '
                              'of Hartford, in Cheshire, England. It is '
                              'situated on the A559 road approximately two '
                              'miles (3.2 km) west of the town of Northwich.',
                              ['History',
                               'Facilities',
                               'Services',
                               'References',
                               'External links']],
 'Isabel Fonseca': ['',
                    'Isabel Fonseca (born 1961, New York City) is an '
                    'American writer.\n'
                    'She is the youngest of Uruguayan sculptor Gonzalo '
                    "Fonseca's four children, and the sister of the "
                    'painters Caio Fonseca and Bruno Fonseca (1958–1994).\n'
                    'She attended Concord Academy and graduated magna cum '
                    'laude from Barnard College in 1984. She then studied '
                    'at Wadham College, Oxford and worked in publishing and '
                    'newspapers in London, notably at the Times Literary '
                    'Supplement.\n'
                    'She is the author of the bestselling Bury Me Standing: '
                    'The Gypsies and Their Journey (1995), a non-fiction '
                    'book about the lives of Romani people.',
                    ['References', 'External links']],
 'Jack (Homes novel)': ['',
                        'Jack is the 1990 debut novel by American writer A. '
                        'M. Homes, published when she was 19. She wrote the '
                        'novel while attending Sarah Lawrence College. It '
                        'is a bildungsroman or coming-of-age novel, dealing '
                        "with a 15-year-old boy's grappling with issues of "
                        'divorce and sexuality in his family and among his '
                        'friends.',
                        ['Plot',
                         'Characters',
                         'Reception',
                         'Adaptation',
                         'References',
                         'External links']],
 'Kiss': ['William-Adolphe_Bouguereau_(1825-1905)_-_A_Little_Coaxing_(1890).jpg',
          "A kiss is the touch or pressing of one's lips against another "
          'person or an object. Cultural connotations of kissing vary '
          'widely. Depending on the culture and context, a kiss can express '
          'sentiments of love, passion, romance, sexual attraction, sexual '
          'activity, sexual arousal, affection, respect, greeting, '
          'friendship, peace and good luck, among many others. In some '
          'situations a kiss is a ritual, formal or symbolic gesture '
          'indicating devotion, respect, or sacrament. The word came from '
          'Old English cyssan (“to kiss”), in turn from coss (“a kiss”).',
          ['History',
           'Types',
           'Kiss as ritual',
           'Cultural significance',
           'Contemporary practices',
           'Legality',
           'In religion',
           'Biology and evolution',
           'See also',
           'References',
           'Further reading',
           'External links']],
 'List of serial killers before 1900': ['',
                                        'The following is a list of known '
                                        'serial killers active before 1900, '
                                        'in roughly chronological order.',
                                        ['Active before 1600',
                                         '1600 to 1800',
                                         '1801 to 1830',
                                         '1831 to 1850',
                                         '1851 to 1880',
                                         'After 1881',
                                         'Legendary serial killers',
                                         'See also',
                                         'References']],
 'Murder of Kelly Anne Bates': ['Picture_of_Kelly_Anne_Bates.jpg',
                                'Kelly Anne Bates (18 May 1978 – 16 April '
                                '1996) was a British teenager who was '
                                'murdered in Manchester on 16 April 1996 '
                                'when aged 17. She was tortured over a '
                                'period of four weeks, including having her '
                                'eyes gouged from their sockets up to three '
                                'weeks before her death, by her partner '
                                'James Patterson Smith (born c.\u20091948) '
                                'before being drowned in a bathtub.\n'
                                'The murder inquiry was headed by Detective '
                                'Sergeant Joseph Monaghan of Greater '
                                'Manchester Police, who said: "I have been '
                                'in the police force for 15 years and have '
                                'never seen a case as horrific as this." '
                                'William Lawler, the pathologist who '
                                "examined Bates' body, described her "
                                'injuries as "the worst he had seen on a '
                                'murder victim". Smith, a misogynist with a '
                                'history of violence and torture against '
                                'former lovers, denied murdering Bates but '
                                'was convicted and sentenced to life '
                                'imprisonment on 19 November 1997.',
                                ['Background',
                                 'Murder',
                                 'Trial',
                                 'In the media',
                                 'See also',
                                 'References']],
 'Nicole Moudaber': ['Nicole_Moudaber_03.jpg',
                     'Nicole Moudaber is a Lebanese-Nigerian music producer '
                     'and DJ born in Nigeria. In 2009, Carl Cox described '
                     'her as "the most underrated DJ" to DJ Magazine, which '
                     'helped to launch her career. Her 2013 debut album '
                     'Believe was Number 1 for a month on the Beatport '
                     'techno, tech house, and deep house charts. Moudaber '
                     'has teamed up with techno notables such as Carl Cox, '
                     'Adam Beyer, etc. and she also launched MOOD Records '
                     'imprint in 2012.',
                     ['Biography',
                      'Discography',
                      'Awards and nominations',
                      'Interviews',
                      'References',
                      'External links']],
 'Opernpassage': ['Opernpassage_Panorama.jpg',
                  'The Opernpassage (opera passage) in the Inner City of '
                  'Vienna is a Grade II listed pedestrian underpass under '
                  'the ring road (Ringstraße). It was opened in 1955, a day '
                  'before the re-opening of the nearby Vienna State Opera.\n'
                  'Designed by architect Adolf Hoch it has been a symbol of '
                  'a modern spirit in architecture and urban planning. '
                  'After more than 50 years the City of Vienna undertook a '
                  'complete restoration of the structure, advised by the '
                  'Federal Office for the Protection of Monuments in '
                  'Austria. The passage was reopened on 17 September 2013.',
                  ['References']],
 'Revolution Muslim': ['',
                       'Revolution Muslim (RM) was an organization based in '
                       'New York City that advocated the establishment of a '
                       'traditionalist Islamic state through the removal of '
                       'the current rulers in Muslim-majority nations and '
                       'an end to what they consider "Western imperialism". '
                       'It was founded in 2007 by two American men, one of '
                       'them Jewish, who had converted to Islam.\n'
                       'They operated both on their website '
                       '"RevolutionMuslim.com" and through street preaching '
                       'and protests. They frequently protested outside the '
                       'Islamic Cultural Center of New York, a moderate '
                       'Muslim mosque.\n'
                       'The website was eventually shut down on November '
                       '2010, shortly after the arrest of one of the '
                       'leaders.',
                       ['History',
                        'Analysis',
                        'Times Square car bomb',
                        'Former members',
                        'References',
                        'External links']],
 "Tell The Wolves I'm Home": ["Tell_The_Wolves_I'm_Home_cover_page.jpg",
                              "Tell The Wolves I'm Home is the debut novel "
                              'of American writer Carol Rifka Brunt, '
                              'published by Random House in 2012. It '
                              'follows the life of a girl whose homosexual '
                              'uncle had died of AIDS in the 1980s, and the '
                              'subsequent friendship she develops with his '
                              'boyfriend.',
                              ['Plot', 'Writing', 'Reception', 'References']],
 'The Queen of the Tearling': ['The_Queen_of_the_Tearling_cover.jpg',
                               'The Queen of the Tearling is the debut '
                               'novel by Erika Johansen. It is set in the '
                               '24th century, and is the first novel of a '
                               'planned fantasy trilogy.',
                               ['Plot',
                                'Reaction',
                                'Film adaptation',
                                'References',
                                'External links']],
 'Thomas Meehan (writer)': ['',
                            'Thomas Edward Meehan (born August 14, 1929) is '
                            'an American writer, best known for Annie, The '
                            'Producers, and Hairspray.',
                            ['Life and career',
                             'References',
                             'External links']],
 'Uttar Pradesh': ['Uttar_pradesh_Collage.jpg',
                   'Uttar Pradesh (/ˈʊtər prəˈdɛʃ/, Hindi : उत्तर प्रदेश '
                   'literally "Northern Province"), abbreviated as UP, is '
                   'the most populous state in the Republic of India as '
                   'well as the most populous country subdivision in the '
                   'world. It was created on 1 April 1937 as the United '
                   'Provinces during British rule, and was renamed Uttar '
                   'Pradesh in 1950. Lucknow is the capital city of Uttar '
                   'Pradesh. Ghaziabad, Bulandshahr, Kanpur, Gorakhpur, '
                   'Allahabad, Raebareli, Moradabad, Bareilly, Aligarh, '
                   'Sonbhadra, and Varanasi are known for their industrial '
                   'importance in the state. On 9 November 2000, a new '
                   'state, Uttarakhand, was carved out from the Himalayan '
                   'hill region of Uttar Pradesh.',
                   ['History',
                    'Geography',
                    'Flora and Fauna',
                    'Divisions, districts and cities',
                    'Demographics',
                    'Government and politics',
                    'Crime',
                    'Economy',
                    'Transportation',
                    'Sports',
                    'Education',
                    'Tourism',
                    'Culture',
                    'Media',
                    'See also',
                    'References',
                    'External links']],
 'Will Self': ['13323-Will_Self_Reading_-1660-Edit.jpg',
               'William Woodard Self (born 26 September 1961) is an English '
               'novelist, journalist, political commentator and television '
               'personality.\n'
               'Self is the author of ten novels, five collections of '
               'shorter fiction, three novellas, and five collections of '
               'non-fiction writing. His work has been translated into 22 '
               'languages; his 2002 novel, Dorian was longlisted for the '
               'Booker Prize, and his novel Umbrella was shortlisted for '
               'the Man Booker Prize. His fiction is known for being '
               'satirical, grotesque, and fantastical, and is predominantly '
               'set within his home city of London. His subject matter '
               'often includes mental illness, illegal drugs, and '
               'psychiatry.',
               ['Early life',
                'Career',
                'Literary style',
                'Personal life',
                'Awards',
                'Works',
                'References',
                'External links']],
 'Yazoo and Mississippi Valley Railroad': ['',
                                           'The Yazoo and Mississippi '
                                           'Valley Railroad (Y&MV) was '
                                           'incorporated in 1882 and was '
                                           'part of the Illinois Central '
                                           'Railroad system (IC). '
                                           'Construction began in Jackson, '
                                           'Mississippi, and continued to '
                                           'Yazoo City, Mississippi. The '
                                           'line was later expanded through '
                                           'the Mississippi Delta and on to '
                                           'Memphis, Tennessee. In 1886, '
                                           'the IC purchased the '
                                           'Mississippi and Tennessee '
                                           'Railroad. In 1892, the IC '
                                           'bought the Memphis to New '
                                           'Orleans line, forming the '
                                           'Louisville, New Orleans and '
                                           'Texas Railway.',
                                           ['Blues music',
                                            'See also',
                                            'References',
                                            'External links']]}
print(len(ar_content))
24

Still to do

  • create a list of the 24 articles with jointly available recommendations
  • store article lead text and lead images together, like I do with recommendation descriptions, lead, and images
  • finalize templates for article text section
  • finalize template for recommendations text section (probably need to list these above/below
  • create a lookup table with 1 and 2 versions of each article in the sample, and randomly assign WV and CS recs to either the a or b section in each version (simplest solution that's not transparently obvious to the user)
  • test publish with a single article (both versions)

Build a lookup table

Dict with two entries for each article. One entry has "_a" appended, the other has "_b" appended.

#already saved the keys. Do not use this.

# from random import shuffle

# def a_b_condition_assignment(title):
#     """
#     Accepts an article title, returns a dict with a recommender model randomly assigned to each of two conditions.
#     """
#     models = ["wv_recs", "cs_recs"]
#     condition = {'a':None, 'b':None}
#     shuffle(models)
#     condition['a'] = models[0]
#     condition['b'] = models[1]

#     return condition
#already saved the keys. Do not use this.

# ar_conditions = {}

# for ar in ar_content.keys():
#     ar_conditions[ar] = a_b_condition_assignment(ar)
#already saved the keys. Do not use this.

# pprint(ar_conditions)
#need to double these, append 1 and 2, and swap the values
#already saved the keys. Do not use this.

# with open('wv_cs_a_b_conditions.json', 'w') as fout:
#     json.dump(ar_conditions, fout, sort_keys=True)
#load the saved version
with open('wv_cs_a_b_conditions.json', 'r') as fin:
    ar_conditions = json.load(fin)

pprint(ar_conditions)
{'2016 Los Angeles Kiss season': {'a': 'cs_recs', 'b': 'wv_recs'},
 'A Summer Bird-Cage': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Amanda Green': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Andrew Michael Hurley': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Cathy Marie Buchanan': {'a': 'cs_recs', 'b': 'wv_recs'},
 'Did You Ever Have a Family': {'a': 'cs_recs', 'b': 'wv_recs'},
 'Don Perata': {'a': 'cs_recs', 'b': 'wv_recs'},
 'Francis Patrick Donovan': {'a': 'cs_recs', 'b': 'wv_recs'},
 'Gary Rowett': {'a': 'cs_recs', 'b': 'wv_recs'},
 'Hartford railway station': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Isabel Fonseca': {'a': 'cs_recs', 'b': 'wv_recs'},
 'Jack (Homes novel)': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Kiss': {'a': 'wv_recs', 'b': 'cs_recs'},
 'List of serial killers before 1900': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Murder of Kelly Anne Bates': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Nicole Moudaber': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Opernpassage': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Revolution Muslim': {'a': 'cs_recs', 'b': 'wv_recs'},
 "Tell The Wolves I'm Home": {'a': 'cs_recs', 'b': 'wv_recs'},
 'The Queen of the Tearling': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Thomas Meehan (writer)': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Uttar Pradesh': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Will Self': {'a': 'wv_recs', 'b': 'cs_recs'},
 'Yazoo and Mississippi Valley Railroad': {'a': 'cs_recs', 'b': 'wv_recs'}}
#update conditions.
ar_conditions_doubled = {}

for k,v in ar_conditions.items():
    ar_conditions_doubled[k] = {}
    ar_conditions_doubled[k]["1"] = v
    swapped = {'a' : v['b'], 'b' : v['a']}
    ar_conditions_doubled[k]["2"]= swapped
pprint(ar_conditions_doubled) 
{'2016 Los Angeles Kiss season': {'1': {'a': 'cs_recs', 'b': 'wv_recs'},
                                  '2': {'a': 'wv_recs', 'b': 'cs_recs'}},
 'A Summer Bird-Cage': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                        '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Amanda Green': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                  '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Andrew Michael Hurley': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                           '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Cathy Marie Buchanan': {'1': {'a': 'cs_recs', 'b': 'wv_recs'},
                          '2': {'a': 'wv_recs', 'b': 'cs_recs'}},
 'Did You Ever Have a Family': {'1': {'a': 'cs_recs', 'b': 'wv_recs'},
                                '2': {'a': 'wv_recs', 'b': 'cs_recs'}},
 'Don Perata': {'1': {'a': 'cs_recs', 'b': 'wv_recs'},
                '2': {'a': 'wv_recs', 'b': 'cs_recs'}},
 'Francis Patrick Donovan': {'1': {'a': 'cs_recs', 'b': 'wv_recs'},
                             '2': {'a': 'wv_recs', 'b': 'cs_recs'}},
 'Gary Rowett': {'1': {'a': 'cs_recs', 'b': 'wv_recs'},
                 '2': {'a': 'wv_recs', 'b': 'cs_recs'}},
 'Hartford railway station': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                              '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Isabel Fonseca': {'1': {'a': 'cs_recs', 'b': 'wv_recs'},
                    '2': {'a': 'wv_recs', 'b': 'cs_recs'}},
 'Jack (Homes novel)': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                        '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Kiss': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
          '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'List of serial killers before 1900': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                                        '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Murder of Kelly Anne Bates': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                                '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Nicole Moudaber': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                     '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Opernpassage': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                  '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Revolution Muslim': {'1': {'a': 'cs_recs', 'b': 'wv_recs'},
                       '2': {'a': 'wv_recs', 'b': 'cs_recs'}},
 "Tell The Wolves I'm Home": {'1': {'a': 'cs_recs', 'b': 'wv_recs'},
                              '2': {'a': 'wv_recs', 'b': 'cs_recs'}},
 'The Queen of the Tearling': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                               '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Thomas Meehan (writer)': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                            '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Uttar Pradesh': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
                   '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Will Self': {'1': {'a': 'wv_recs', 'b': 'cs_recs'},
               '2': {'a': 'cs_recs', 'b': 'wv_recs'}},
 'Yazoo and Mississippi Valley Railroad': {'1': {'a': 'cs_recs',
                                                 'b': 'wv_recs'},
                                           '2': {'a': 'wv_recs',
                                                 'b': 'cs_recs'}}}

Testing

Test populating my templates with data for a single article. Then test publishing that article to test.wikipedia

Test populating article preview template

test_article_preview = ar_content['Francis Patrick Donovan']
pprint(test_article_preview)
['Francis_Patrick_Donovan,_Australian_Diplomat,_1977.jpg',
 'Francis Patrick Donovan, AM (1 February 1922 − 3 February 2012) was '
 'Australian Ambassador and Permanent Representative to the OECD, and '
 'Ambassador and Special Trade Delegate to the United Nations Office at '
 'Geneva. After retirement from the Diplomatic Service, he became a '
 'Vice-Chairman of the International Court of Arbitration.',
 ['Early life',
  'Educational career',
  'Diplomatic career',
  'Later life and death',
  'Awards and decorations',
  'References']]
page_template = """
__NOEDITSECTION__
__NOTOC__
[[File:{article[0]}|right|200px]]
{article[1]}

{sections}

"""
formatted_headings = "\n\n".join(["==" + x + "==" for x in test_article_preview[2]])
print(formatted_headings)
==Early life==

==Educational career==

==Diplomatic career==

==Later life and death==

==Awards and decorations==

==References==
formatted_test_preview = page_template.format(article=test_article_preview, sections="\n\n".join(["==" + x + "==" for x in test_article_preview[2]]))
print(formatted_test_preview)
__NOEDITSECTION__
__NOTOC__
[[File:Francis_Patrick_Donovan,_Australian_Diplomat,_1977.jpg|right|200px]]
Francis Patrick Donovan, AM (1 February 1922 − 3 February 2012) was Australian Ambassador and Permanent Representative to the OECD, and Ambassador and Special Trade Delegate to the United Nations Office at Geneva. After retirement from the Diplomatic Service, he became a Vice-Chairman of the International Court of Arbitration.

==Early life==

==Educational career==

==Diplomatic career==

==Later life and death==

==Awards and decorations==

==References==


test_recs = top3_recs_info['Francis Patrick Donovan']
pprint(test_recs)
{'cs_recs': [{'description': '',
              'extract': 'The Ambassador and Permanent Representative of '
                         'Australia to the World Trade Organization is an '
                         'officer of the Australian Department of Foreign '
                         'Affairs and Trade and the head of the Permanent '
                         'Mission of the Commonwealth of Australia to the '
                         'World Trade Organization (WTO) in Geneva, '
                         'Switzerland.',
              'pageimage': 'Coat_of_Arms_of_Australia.svg',
              'title': 'Permanent Representative of Australia to the World '
                       'Trade Organization'},
             {'description': 'Australian diplomat',
              'extract': 'Damien Patrick Miller is an Australian career '
                         'diplomat and the first Indigenous Australian to '
                         'head an Australian diplomatic mission.',
              'pageimage': 'Damien_Miller_(1).jpg',
              'title': 'Damien Miller'},
             {'description': '',
              'extract': 'Ivor Francis Sutherland Vincent CMG MBE (14 '
                         'October 1912 – 5 May 1994) was a British '
                         'diplomat and co-founder of the Andean Project.',
              'pageimage': 'Antu_folder-camera.svg',
              'title': 'Ivor Vincent'}],
 'wv_recs': [{'description': 'British writer',
              'extract': 'Chantal Sophia "Tessa" Dahl (born 11 April 1957) '
                         'is an English author and former actress.',
              'pageimage': 'Antu_folder-camera.svg',
              'title': 'Tessa Dahl'},
             {'description': 'British screenwriter',
              'extract': 'Lucy Neal Dahl (born 4 August 1965) is a British '
                         'screenwriter and daughter of Welsh author Roald '
                         'Dahl and American actress Patricia Neal.',
              'pageimage': 'Lucy_Dahl_at_the_2016_Cannes_Film_Festival.jpg',
              'title': 'Lucy Dahl'},
             {'description': 'American activist',
              'extract': 'Ophelia Magdalena Dahl (born 12 May 1964) is a '
                         'British social justice and health care advocate.',
              'pageimage': 'Antu_folder-camera.svg',
              'title': 'Ophelia Dahl'}]}
def recommendation_section(con, rec_lists, template):
    rec_params = {}
    for k,v in con.items():
        print(k)
        print(v)
        model = k
        rec_params["model_" + k] = v
        for i, r in enumerate(rec_lists[v]):
            rec_params["title_" + k + "_" + str(i+1)] = r['title']
            rec_params["preview_" + k + "_" + str(i+1)] = r['extract']
            rec_params["description_" + k + "_" + str(i+1)] = r['description']
            rec_params["image_" + k + "_" + str(i+1)] = r['pageimage']
    
    pprint(rec_params)
    formatted = template.format(**rec_params)
    
    return formatted
con = ar_conditions_doubled['Francis Patrick Donovan']
pprint(con)
{'1': {'a': 'cs_recs', 'b': 'wv_recs'}, '2': {'a': 'wv_recs', 'b': 'cs_recs'}}
recs_template = """
==Read more==

===Option A===
<!-- {model_a} -->
{{|
|-
| [[File:{image_a_1}|75px]]
| '''{title_a_1}'''<br/><span style="color:gray">{description_a_1}</span>
| ''{preview_a_1}''
|-
| [[File:{image_a_2}|75px]]
| '''{title_a_2}'''<br/><span style="color:gray">{description_a_2}</span>
| ''{preview_a_2}''
|-
| [[File:{image_a_3}|75px]]
| '''{title_a_3}'''<br/><span style="color:gray">{description_a_3}</span>
| ''{preview_a_3}''
|-
|}}

===Option B===
<!-- {model_b} -->
{{|
|-
| [[File:{image_b_1}|75px]]
| '''{title_b_1}'''<br/><span style="color:gray">{description_b_1}</span>
| ''{preview_b_1}''
|-
| [[File:{image_b_2}|75px]]
| '''{title_b_2}'''<br/><span style="color:gray">{description_b_2}</span>
| ''{preview_b_2}''
|-
| [[File:{image_b_3}|75px]]
| '''{title_b_3}'''<br/><span style="color:gray">{description_b_3}</span>
| ''{preview_b_3}''
|-
|}}

"""
formatted_recs_preview = recommendation_section(con['2'], test_recs, recs_template)
b
cs_recs
a
wv_recs
{'description_a_1': 'British writer',
 'description_a_2': 'British screenwriter',
 'description_a_3': 'American activist',
 'description_b_1': '',
 'description_b_2': 'Australian diplomat',
 'description_b_3': '',
 'image_a_1': 'Antu_folder-camera.svg',
 'image_a_2': 'Lucy_Dahl_at_the_2016_Cannes_Film_Festival.jpg',
 'image_a_3': 'Antu_folder-camera.svg',
 'image_b_1': 'Coat_of_Arms_of_Australia.svg',
 'image_b_2': 'Damien_Miller_(1).jpg',
 'image_b_3': 'Antu_folder-camera.svg',
 'model_a': 'wv_recs',
 'model_b': 'cs_recs',
 'preview_a_1': 'Chantal Sophia "Tessa" Dahl (born 11 April 1957) is an '
                'English author and former actress.',
 'preview_a_2': 'Lucy Neal Dahl (born 4 August 1965) is a British '
                'screenwriter and daughter of Welsh author Roald Dahl and '
                'American actress Patricia Neal.',
 'preview_a_3': 'Ophelia Magdalena Dahl (born 12 May 1964) is a British '
                'social justice and health care advocate.',
 'preview_b_1': 'The Ambassador and Permanent Representative of Australia to '
                'the World Trade Organization is an officer of the '
                'Australian Department of Foreign Affairs and Trade and the '
                'head of the Permanent Mission of the Commonwealth of '
                'Australia to the World Trade Organization (WTO) in Geneva, '
                'Switzerland.',
 'preview_b_2': 'Damien Patrick Miller is an Australian career diplomat and '
                'the first Indigenous Australian to head an Australian '
                'diplomatic mission.',
 'preview_b_3': 'Ivor Francis Sutherland Vincent CMG MBE (14 October 1912 – '
                '5 May 1994) was a British diplomat and co-founder of the '
                'Andean Project.',
 'title_a_1': 'Tessa Dahl',
 'title_a_2': 'Lucy Dahl',
 'title_a_3': 'Ophelia Dahl',
 'title_b_1': 'Permanent Representative of Australia to the World Trade '
              'Organization',
 'title_b_2': 'Damien Miller',
 'title_b_3': 'Ivor Vincent'}
print(formatted_recs_preview)
==Read more==

===Option A===
<!-- wv_recs -->
{|
|-
| [[File:Antu_folder-camera.svg|75px]]
| '''Tessa Dahl'''<br/><span style="color:gray">British writer</span>
| ''Chantal Sophia "Tessa" Dahl (born 11 April 1957) is an English author and former actress.''
|-
| [[File:Lucy_Dahl_at_the_2016_Cannes_Film_Festival.jpg|75px]]
| '''Lucy Dahl'''<br/><span style="color:gray">British screenwriter</span>
| ''Lucy Neal Dahl (born 4 August 1965) is a British screenwriter and daughter of Welsh author Roald Dahl and American actress Patricia Neal.''
|-
| [[File:Antu_folder-camera.svg|75px]]
| '''Ophelia Dahl'''<br/><span style="color:gray">American activist</span>
| ''Ophelia Magdalena Dahl (born 12 May 1964) is a British social justice and health care advocate.''
|-
|}

===Option B===
<!-- cs_recs -->
{|
|-
| [[File:Coat_of_Arms_of_Australia.svg|75px]]
| '''Permanent Representative of Australia to the World Trade Organization'''<br/><span style="color:gray"></span>
| ''The Ambassador and Permanent Representative of Australia to the World Trade Organization is an officer of the Australian Department of Foreign Affairs and Trade and the head of the Permanent Mission of the Commonwealth of Australia to the World Trade Organization (WTO) in Geneva, Switzerland.''
|-
| [[File:Damien_Miller_(1).jpg|75px]]
| '''Damien Miller'''<br/><span style="color:gray">Australian diplomat</span>
| ''Damien Patrick Miller is an Australian career diplomat and the first Indigenous Australian to head an Australian diplomatic mission.''
|-
| [[File:Antu_folder-camera.svg|75px]]
| '''Ivor Vincent'''<br/><span style="color:gray"></span>
| ''Ivor Francis Sutherland Vincent CMG MBE (14 October 1912 – 5 May 1994) was a British diplomat and co-founder of the Andean Project.''
|-
|}


Create the page on Wiki

#get your username
import os

uname = os.environ['JPY_USER']
# asks for your password. Make sure to save it as a variable, don't print it.
#see https://docs.python.org/3.1/library/getpass.html
import getpass

pw = getpass.getpass()
········
#from https://www.mediawiki.org/wiki/API:Edit/Editing_with_Python
#see also:
# - https://www.mediawiki.org/wiki/API:Login
# - https://www.mediawiki.org/wiki/API:Userinfo
# - https://www.mediawiki.org/wiki/API:Edit

username = uname
password = pw
baseurl = 'https://test.wikipedia.org/w/'
summary = 'testing recs article creation'
message = formatted_test_preview + formatted_recs_preview
title = 'User:Jmorgan (WMF)/' +  'Francis Patrick Donovan' + ' 2'
#add page title plus condition string
#https://test.wikipedia.org/wiki/User:Jtmorgan/sandbox

#see
# - https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields
# - http://stackoverflow.com/questions/10606133/sending-user-agent-using-requests-library-in-python
headers={'User-Agent' : 'Testing API edits', 'From' : 'jmorgan@wikimedia.org'}

# Login request
payload = {'action': 'query', 'format': 'json', 'utf8': '', 'meta': 'tokens', 'type': 'login'}
r1 = requests.post(baseurl + 'api.php', data=payload)

# login confirm
login_token = r1.json()['query']['tokens']['logintoken']
payload = {'action': 'login', 'format': 'json', 'utf8': '', 'lgname': username, 'lgpassword': password, 'lgtoken': login_token}
r2 = requests.post(baseurl + 'api.php', data=payload, cookies=r1.cookies)

# get edit token2
params3 = '?format=json&action=query&meta=tokens&continue='
r3 = requests.get(baseurl + 'api.php' + params3, cookies=r2.cookies)
edit_token = r3.json()['query']['tokens']['csrftoken']

edit_cookie = r2.cookies.copy()
edit_cookie.update(r3.cookies)

# save action
payload = {'action': 'edit', 'assert': 'user', 'format': 'json', 'utf8': '', 'text': message,'summary': summary, 'title': title, 'token': edit_token}
r4 = requests.post(baseurl + 'api.php', data=payload, cookies=edit_cookie, headers=headers)

print (r4.text)
{"error":{"code":"assertuserfailed","info":"Assertion that the user is logged in failed.","*":"See https://test.wikipedia.org/w/api.php for API usage."},"servedby":"mw1283"}

To do

  • make list of mobile urls for each condition (key/value pairs with titles + appends)
  • double and append for condition dict
  • update table formatting