Skip to content

Instantly share code, notes, and snippets.

@tiaplagata
tiaplagata / basic_wc_func.py
Last active November 7, 2021 23:57
function to generate a word cloud from text
#Define a list of stop words
stopwords = ['private', 'tour', 'transfer', 'guide', 'skip', 'line',
'skiptheline', 'vice', 'versa']
#A function to generate the word cloud from text
def generate_basic_wordcloud(data, title):
cloud = WordCloud(width=400,
height=330,
max_words=150,
colormap='tab20c',
# Store our document term matrix data for Rome
data = dtm.transpose()['Rome, Italy'].sort_values(ascending=False)
# Generate the word cloud from frequencies
wc = WordCloud().generate_from_frequencies(data)
plt.imshow(wc)
plt.axis('off')
plt.show()
@tiaplagata
tiaplagata / basic_wordcloud.py
Last active November 7, 2021 23:57
creating a basic word cloud from text corpus
#Give our Rome corpus a variable name
rome_corpus = df.lemmatized[10]
#Instantiate wordcloud object and use method to feed it our corpus
wc = WordCloud().generate_from_text(rome_corpus)
#Use matplotlib.pyplot to display the fitted wordcloud
#Turn axis off to get rid of axis numbers
plt.imshow(wc)
plt.axis('off')
@tiaplagata
tiaplagata / wordcloud_imports.py
Last active November 7, 2021 23:56
imports needed for word clouds
from wordcloud import WordCloud, ImageColorGenerator
from PIL import Image
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
@xtian
xtian / html5boilerplate.jade
Last active December 23, 2023 15:05
HTML5 Boilerplate in jade
!!! 5
html(class='no-js')
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
title
meta(name='description', content='')
meta(name='viewport', content='width=device-width, initial-scale=1')