Bonjour
avec un peu de retard, voici ma carte de voeux
les noms à l'intérieur des lettres sont extraits des gens illustres et français morts en 2016 sur Wikidata
la requête
SELECT ?subj ?subjLabel ?subjDescription ?date WHERE { ?subj wdt:P31 wd:Q5. ?subj wdt:P27 wd:Q142. ?subj wdt:P106 ?occupation. ?subj wdt:P570 ?date. FILTER (YEAR(?date) = 2016) SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". } } ORDER BY ?date LIMIT 1000
sur wikidata query service http://tinyurl.com/zcqrtvo
et j'utilise le script wordcloud en python
https://github.com/amueller/word_cloud
#!/usr/bin/env python """ Masked wordcloud ================ Using a mask you can generate wordclouds in arbitrary shapes. """ from os import path from PIL import Image import numpy as np import matplotlib.pyplot as plt import random from wordcloud import WordCloud, STOPWORDS def grey_color_func(word, font_size, position, orientation, random_state=None, **kwargs): return "hsl(0,0%,100%)" d = path.dirname(__file__) # Read the whole text. text = open(path.join(d, 'wordcloud.txt')).read() # read the mask image # taken from # http://www.stencilry.org/stencils/movies/alice%20in%20wonderland/255fk.jpg alice_mask = np.array(Image.open(path.join(d, "PhotoInitiale.jpg"))) stopwords = set(STOPWORDS) stopwords.add("said") wc = WordCloud(background_color="black", max_words=6000, mask=alice_mask, stopwords=stopwords,max_font_size=11,prefer_horizontal=1,margin=1) # generate word cloud wc.generate(text) # store default colored image wc.recolor(color_func=grey_color_func, random_state=3) wc.to_file(path.join(d, "PhotoFinale.jpg"))
Bonne année
Hors ligne