Last active
January 14, 2021 18:24
-
-
Save stkbailey/026176085c6aaa07dd21dcaf30976ee8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This is a simple script to download comments from /r/utahjazz, | |
## look for bigrams that start with "G" then "H" (or vice versa), | |
## filter out likely non-names, and print them. | |
# Imports | |
import requests | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.common.exceptions import TimeoutException | |
from bs4 import BeautifulSoup | |
import json | |
import time | |
import datetime | |
import pandas as pd | |
import nltk | |
# Create a date list for the last 367 days, at 12 hour intervals | |
base = datetime.datetime.today() | |
date_list = [base - datetime.timedelta(days=x, hours=y) | |
for x in range(0, 367, 1) for y in [0,12]] | |
# For each time period, download all comments from pushshift.io | |
all_comments = [] | |
for ii in range(1, len(date_list)): | |
t1 = int(date_list[ii-1].timestamp()) | |
t2 = int(date_list[ii].timestamp()) | |
# Create API request | |
pushshift = 'https://api.pushshift.io/reddit/comment/search/?' | |
pushshift += 'subreddit=utahjazz&sort=desc&sort_type=created_utc' | |
pushshift += '&after={}&before={}&size=1000'.format(t2, t1) | |
# Get data, add to list, then sleep for 2 seconds | |
r = requests.get(pushshift) | |
all_comments += json.loads(r.text)['data'] | |
time.sleep(2) | |
# Turn it into a DataFrame | |
df = pd.DataFrame(all_comments) | |
## Filter comment text | |
def find_gh_phrases(text): | |
'''Pulls out all bigrams with a string of ('g___', 'h___') or ('h___', 'g____'). | |
If any of the contained words are in the "stop_words" list, the bigram is dropped.''' | |
tokenizer = nltk.tokenize.WordPunctTokenizer() | |
tokens = tokenizer.tokenize(text.lower()) | |
candidates = [(x,y) for (x,y) in nltk.bigrams(tokens) | |
if ((x[0] == 'g') & (y[0] == 'h')) | |
| ((x[0] == 'h') & (y[0] == 'g'))] | |
stop_words = ['get', 'him', 'glad', 'he', 'gobert', 'hope', 'hmm', 'his', 'game', 'good', 'going', | |
'hurt', 'has', 'grown', 'holder', 'hit', 'honestly', 'have', 'got', 'gonna', 'how', | |
'great', 'hey', 'guys', 'gets', 'had', 'given', 'hear', 'go', 'hard', 'gm', 'guy', | |
'hispanic', 'himself', 'harden', 'hill', 'happy', 'games', 'herpes', 'give', 'grayson', | |
'hidden', 'hes', 'girl', 'host', 'getting', 'geen', 'gems', 'giving', 'gained', 'having', 'gh', | |
'hot', 'historical', 'hate', 'gave', 'hold', 'huge', 'heart', 'heard', 'gap', 'goes' ,'gotta', 'healthy', | |
'hood', 'hasn', 'high', 'guard', 'hams', 'goalie', 'gotten', 'gold', 'god', 'here', 'help', | |
'half', 'greater', 'glory', 'humanity', 'grow', 'hug', 'hurts', 'hail', 'gone', 'giannis', | |
'homeless', 'highlights', 'human', 'hornacek', 'gut', 'girlfriend', 'hole', 'hottest', 'gags', | |
'girls', 'google', 'g', 'gone', 'grail', 'generally', 'homer', 'h', 'haha', 'higher', 'gl', 'george', | |
'humility', 'her', 'hi', 'gail', 'hangs', 'greatly', 'gives', 'gives', 'harrassing', 'https' ] | |
stop_filt = [(x,y) for (x,y) in candidates if (x not in stop_words) & (y not in stop_words)] | |
if len(stop_filt) > 0: | |
return stop_filt | |
else: | |
return None | |
matches = df.body.apply(find_gh_phrases).dropna() | |
# Write all unique names to disk | |
all_names = [] | |
for li in matches: | |
for l in li: | |
all_names.append(' '.join(s.capitalize() for s in l)) | |
with open('gh-names.txt', 'w') as f: | |
f.write('\n'.join(set(all_names))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gordan Hayward | |
Gravack Hallick | |
House Growing | |
Grimhor Haypenny | |
Goblin Hadwood | |
Goulash Handtowel | |
Gronker Headboard | |
Gerceaux Heiword | |
Grumble Higgensworth | |
Gershwin Harold | |
Gamble Hambreath | |
Goggles Hamstring | |
Gregory Hobard | |
Green Horseradish | |
Gentry Hemsworth | |
Grated Hairball | |
Garbage Hero | |
Hrooks Goran | |
Gorgon Heehaw | |
Glorbon Headwound | |
Geffert Hibblestrim | |
Gerten Hamburglar | |
Gordy Hay | |
Garbanzo Hayfever | |
Hordon Gaywood | |
Gerden Haywood | |
Gershwin Humpwaffle | |
Gerbil Handler | |
Giddle Hinklewooten | |
Greg Hayden | |
Gertrude Hamswalloe | |
Hibblestrim Godart | |
Gergich Humpdick | |
Googoodoll Humperdink | |
Gargoyle Hardwood | |
Grompdump Horeblood | |
Goosebump Handstand | |
Gerber Hamsterfood | |
Gordan Howard | |
Garden Hempseed | |
Houston Gs | |
Giovanni Hammond | |
Gaywad Hardon | |
Goozparp Holdjob | |
Gortot Heywanks | |
Huddled Group | |
Grumbley Hootenanny | |
Greedo Houndstooth | |
Goberts Hands | |
Gornathan Hayson | |
Grabden Hackwords | |
Gordan Heighwould | |
Gertrude Haynesford | |
Gary Heimlick | |
Gsw Hell | |
Hagina Garfgarfunkle | |
Holdfarts Giljinny | |
Gaylord Handwash | |
Gerald Harland | |
Gridiron Hardwood | |
Gropan Hoopwoof | |
Goober Handsward | |
Grody Hunter | |
Gordon Heywood | |
Garbage Harlet | |
Gershwin Hairplugs | |
Groupon Hillbilly | |
Harmon Gunther | |
Gary Harris | |
Garbonzo Hamtrails | |
Gary Howard | |
Gorban Haywood | |
Haljizzmean Golfhonzo | |
Gibraltar Hamburg | |
Hamstrip Geffert | |
Gorgon Hairsnakes | |
Gorgonzola Havarti | |
Georgian Hindu | |
Gogdon Hardwonovic | |
Grindlechode Hagworth | |
Gramblepam Higforth | |
Goobered Handswanker | |
Gelbin Horgor | |
Globby Hushpuppy | |
Groundhog Hotdog | |
Gregory Hibblewart | |
Garden Haywood | |
Goblin Hooberstank | |
Gunther Hermansen | |
Greg Hammond | |
Giovanni Hannibal | |
Gorshaun Habbelsmash | |
Houston Gst | |
Gregor Hedwig | |
Gourmet Hardrive | |
Graham Howards | |
Hordan Gayward | |
Gundo Hamstrip | |
Gary Hamilton | |
Gorchen Haykerd | |
Groupon Hedwig | |
Gibbley Halfsquash | |
Guarantee Home | |
Georgia Hungary | |
Gayward Hordon | |
Gary Hatwool | |
Gertrude Haybottom | |
Gregenton Hotsoups | |
Groupon Hardwood | |
Gumdrop Haberdasher | |
Gawain Hardwick | |
Gerald Hilux | |
Gofdan Hoolnard | |
Gonalngo Halberto | |
Groupie Hoe | |
Gramon Hangleberg | |
Garbonzo Hardwood | |
Gucci Hamsandwich | |
Gorgie Howard | |
Grumster Herdwatch | |
Gibraltar Herringbone | |
Goodwill Harbor | |
Gretchen Herriwether | |
Gabe Hansworth | |
Griffin Hazenwinkle | |
Hottakealert Gordon | |
Gross Hotdog | |
Guess Houston | |
Graden Hibachi | |
Geoffrey Horflesband | |
Gorgan Hayworth | |
Hoops Generation | |
Gorbon Hardwod | |
Gary Hardwood | |
Gravy Hobart | |
Garbanzo Hayworms | |
Gaylord Herford | |
Gene Hatlard | |
Gorgonzola Heywod | |
Grogdon Hamwarg | |
Goofus Hedgecut | |
Gregshaw Hannible | |
Goodbye Happen | |
Hurting Golden | |
Gordon Humpdick | |
Guessers Haven | |
Garden Hardware | |
Gordon Heymaker | |
Gayrod Harpoon | |
Hawking Guards | |
Gorgon Hadwood | |
Hardon Gayward | |
Gorgon Hayman | |
Gorheck Hobaglob | |
Gorbrud Herclesmeier | |
Generating Hype | |
Granite Hardwood | |
Groupon Hardon | |
Grabsand Hubistank | |
Graham Haywinch | |
Geofferton Howlerfax | |
Gaylord Hardhole | |
Gilbert Hairdoodle | |
Haylord Gobblecock | |
Gaylord Hamburgerstrain | |
Gary Hedgeclippers | |
Gribbon Hindlegorf | |
Gojack Hairsman | |
Goofkit Hobbit | |
Gertrude Harward | |
Godric Hackenberger | |
Gertrude Harblood | |
Gangbanger Hairgel | |
Gotdamn Hands | |
Hayward Genuinely | |
Gerard Howard | |
Garden Heywood | |
Gorbanzo Hermaphrodite | |
Greg Hubble | |
Globe Hits | |
German Hoover | |
Gentry Hibblesworth | |
Geoff Haynes | |
Gortog Hogwash | |
Gravy Hath | |
Gandolf Halfcourt | |
Grant Hatwood | |
Gabin Hamilton | |
Gory Horrorshow | |
Gordon Happened | |
Grumbling Heirloom | |
Garlind Harninstock | |
Geoffrey Hausman | |
Gordanna Hairweird | |
Gorhan Hardlebridge | |
Grunge Heads | |
Gelatinous Hailstorm | |
Gorman Hayspanker | |
Graydon Haydinger | |
Girobaldi Hempsworth | |
Goober Hargreaves | |
Gross Hamburger | |
Haydo Gorwood | |
Goblin Hogword | |
Garbage Handjob | |
Gourdmans Haybailer | |
Gerbil Haybale | |
Garchomp Haymaker | |
Grabthar Hammerward | |
Greg Horewang | |
Giljinny Hagina | |
Goorgoon Huarlard | |
Godric Humperdink | |
Gerardo Halfoot | |
Geordie Howard | |
Grady Harwad | |
Gunther Henderson | |
Gravelturn Hubblesmith | |
Hand Gesture | |
Gordo Hamwallet | |
Gretchenburg Halfshave | |
Geljerb Hoozbucjet | |
Geeky Haynerd | |
Gertrude Heywad | |
Groinstrain Hemroid | |
Gordung Hayturd | |
Goblin Hogworm | |
Garden Hogwart | |
Goran Haywood | |
Gordon Harwood | |
Glen Howard | |
Gibraltar Henceforth | |
Hired Givony | |
Grant Harlwood | |
Gogo Halturd | |
Hordon Gaywerd | |
Glamboat Hobblestein | |
Goto Hayward | |
Gorvina Hayspank | |
Gaylord Haydick | |
Gobbledegook Hogwash | |
Gordin Hadward | |
Gorgon Heybale | |
Gregor Haymitch | |
Gordo Haywire | |
Gareth Horecrust | |
Giddle Haywinkle | |
Gurmsen Habborsforts | |
Goreng Hardhood | |
Gorman Howard | |
Gabriel Handkerchief | |
Goopy Hymen | |
Glorious Hair | |
Gertrude Harwad | |
Harai Goshi | |
Grindumps Hairsword | |
Green Hatchback | |
Gorsuch Harvard | |
Gordon Hinckley | |
Grotten Hedgwood | |
Günther Hairwood | |
Gilbert Halversteins | |
Guess Ha | |
Hardforts Gundo | |
Garden Home | |
Heated Goat | |
Gargoyle Hogwarts | |
Guardrail Hairpin | |
Grantatollie Harkunckle | |
Gembok Hemdinger | |
Gaydar Hardwood | |
Goodness Hayward | |
Gilgamesh Howitzer | |
Griffon Hardwood | |
Horbon Grayflier | |
Gooberdink Humperback | |
Geralt Hemsworth | |
Gordyn Hardwood | |
Garth Harper | |
Grumble Heilbank | |
Gourmet Handwash | |
Gentry Harrington | |
Hordan Gaywood | |
Grathburg Hammershank | |
Gretchen Hogwind | |
Goatcheese Hasbeen | |
Goodmorning Harthrobbo | |
Gordon Haters | |
Granton Hemsword | |
Goofy Haymyanklessidways | |
Gambit Habersnatch | |
Geoffry Hamburg | |
Gromit Hardware | |
Gorgon Hardwood | |
Geofford Heraldico | |
Gargon Hamwad | |
Gorko Halcornio | |
Garry Harris | |
Gary Haywood | |
Gargamel Haymitch | |
Greebag Halvard | |
Gorgon Harwood | |
Hof Guards | |
Goran Hayrd | |
Geraldo Howard | |
Gloryhole Handwax | |
Gortment Handwet | |
Gangan Howard | |
Garden Hibbachi | |
Guantanamo Horachjeck | |
House Greyjoy | |
Gruceberg Hertinwurther | |
Glindau Hamdinger | |
Grindon Hardwood | |
Gorgonzo Haiwerd | |
Gordon Haywar | |
Gertrude Harwood | |
Gritty Hamburger | |
Gelbert Howard | |
Harassing Gordon | |
Houston Garbage | |
Griff Hufflepuff | |
Gerald Harmward | |
Grover Hamburglar | |
Gaden Harwood | |
Goran Hragic | |
Gonenow Hooward | |
Gordian Halversteins | |
Gretchen Hoodunk | |
Garmallo Hadver | |
Gabriel Hammond | |
Guarantee Homecourt | |
Gordon Heh | |
Gourmet Hamwich | |
Garbon Hackysack | |
Garan Haterwood | |
Gearbox Heimlich | |
Godart Harmpit | |
Gordon Haywood | |
Geldin Hoedown | |
Gourmet Hibachi | |
Gordo Heywhatsup | |
Gobbleknocker Hairintheway | |
Galbatorix Honeysuckle | |
Garschwick Hardywood | |
Garth Howard | |
Gerald Himilton | |
Gridiron Hamwatch | |
Helped Guide | |
Grumble Hogwarts | |
Ginger Hardbread | |
Gargle Hairball | |
Gohn Havlicek | |
Gorbon Harwood | |
Gorgon Haymond | |
Graham Howard | |
Gertrude Helbourne | |
Glass Houses | |
Gordan Haywood | |
Grind House | |
Heorge Gill | |
Grindlechode Hacktown | |
Gembock Hembledinger | |
Gimme Houston | |
Gertrude Harsnick | |
Gobbie Hayfever | |
Gornan Heyweed | |
Hragic Grand | |
Gerard Helphard | |
Globern Haglenerth | |
Garden Handjob | |
Garbage Hayhoo | |
Garage Heywool | |
Gorby Handwad | |
Garth Hrooks | |
Goberts Head | |
Gerond Hawand | |
Garfield Hardwood | |
Geraldine Harvey | |
Grover Hairpin | |
Gerhard Haybread | |
Gargle Hemsworth | |
Gordon Haywad | |
Garbage Head | |
Goofmeister Hairdorkus | |
Ganja Hempsworth | |
Grundle Humpback | |
Gerry Harrison | |
Groban Hemsworth | |
Goran Heyweird | |
Greenwhich Hunkydore | |
Gorgon Herf | |
Gorgon Hotdog | |
Gigglesmash Harglebumps | |
Geoffrey Handanovic | |
Groupon Harwood | |
Gurgon Hamovitch | |
Gorbrush Hreepgood | |
Gamble Haybaker | |
Garlic Halitosis | |
Gorpgomp Hanesberg | |
Gregor Howell | |
Grumblepants Hamhocks | |
Gerrymandering Haywood | |
Gargles Huevos | |
Garland Helgenholtz | |
Geraldo Hermaphrodite | |
Gorgon Hamlet | |
Gorgon Hammerswood | |
Goblin Hamberg | |
Gertrude Helwood | |
Gregory Haverforth | |
Gratuitious Hamster | |
Garcon Hamwad | |
Guess Heyward | |
Goran Heywood | |
Grindelwald Hawking | |
Gargantuan Hickory | |
Goddamn Hilarious | |
Green Hoodie | |
Gravy Hardinger | |
Gennifer Harthballows | |
Gorgonzola Hairjob | |
Gaylord Humperdink | |
Goobledegooker Heystacks | |
Gourdon Haywood | |
Gojack Hairsward | |
Garage Hair | |
Gutter Häagen | |
Gordon Heyward | |
Grundle Hardballs | |
Grumpy Hairball | |
Harthrobbo Gullgingo | |
Gordon Handled | |
Garbo Havard | |
Greg Hoiberg | |
Gerome Häagen | |
Gorboon Haflford | |
Grippy Hamwallet | |
Grimswald Hamond | |
Geoff Haberwank | |
Gorlin Haggendass | |
Gobble Haywonk | |
Gary Heywerd | |
Grand Homes | |
Grant Harward | |
Gilbert Hufflepuff | |
Garlic Hardbread | |
Gertrud Hornswoggle | |
Gorgonzola Handbag | |
Greasy Hair | |
Garbanzo Halfoot | |
Golfhonzo Hardforts | |
Gibraltar Happenstance | |
Gerpwerd Hardsack | |
Gorgynne Habernathy | |
Gerdo Herywood | |
Gendry Harwand | |
Gargantuan Harvard | |
Gsw Home | |
Gorgon Heynerd | |
Garden Hoeyard | |
Holy Ghost | |
Geraldo Honeybutter | |
Groudon Hardwood | |
Gorpert Hallaway | |
Gilgamesh Hatherwell | |
Gorban Hamwich | |
Gullgingo Haljizzmean | |
Gourmet Hamburger | |
Gorgon Haybad | |
Hall Gaper | |
Gerber Housewarmer | |
Garbanzo Hotel | |
Grimwald Hempstone | |
Geordie Haibard | |
Gathering Happens | |
Gordon Hayward | |
Gangrene Herpesvirus | |
Halberto Goodmorning | |
Horace Grant | |
Grabble Hornbug | |
Hero Growing | |
Gorgonzola Haywood | |
Garbanzo Hantavirus | |
Grand Hills | |
Garbanzo Heywarts | |
Gary Hufflepuff | |
Hardcore Group | |
Georgio Harmoni | |
Gorging Hangnail | |
Groupon Hediwig | |
Garden Hardwood | |
Gurman Halverstein | |
Hordon Greywood | |
Gropton Harwuld | |
Gargar Harward | |
Goosebump Horsecrap | |
Gentrified Hogbreath | |
Gringotts Hardwood | |
Gorhemm Hayroids | |
Grahamite Hemsworth | |
Gerald Henderson | |
Giant Hands | |
Gordog Humpcouch | |
Goshdarn Haybale | |
Grodoan Haywood | |
Gaston Hoddard | |
Goblin Hogwarts | |
Gaylord Hardwood | |
Garbanzo Harlot | |
Gorgonzola Hamburger | |
Gorlami Hashbrown | |
Gelfen Helferd | |
Gorbin Hardwood | |
Greatest Hair | |
Giddy Holy | |
Gobblecock Howsyourbum | |
Grandparents House | |
Hardon Garbtrottle | |
Hordon Gayward | |
Gorgoroth Hobbiton | |
Gargle Hobble | |
Ganondorf Hardwire | |
Goldie Hawn | |
Goober Hoover | |
Gogdran Heylard | |
Hairdo Graybush | |
Greg Haynes | |
Gordog Hogwash | |
Gorgon Haywood | |
Georgio Heinwarf | |
Garden Hoevard | |
Goodleg Hardbone | |
General Homers | |
Galen Hibachi | |
Hayward Grew | |
Gargoyle Hammerschmidt | |
Hoardthat Gayporn | |
Gordoff Hairtotem | |
Gigglemash Harglebumps | |
Giselle Hortwood | |
Gary Herbert | |
Goober Hairweird | |
Grondo Hamwad | |
Gumball Hairytoes | |
Ganhana Holdfarts | |
Goran Hobbledegook | |
Husky Gentleman | |
Gorboon Haywold | |
Gorgon Heilwood | |
Gooble Haybobble | |
Germinating Hermaphrodite | |
Grab Headlines | |
Grewmin Howdirt | |
Gryffindor Hufflepuff | |
Gorgonite Hogwarts | |
Gerald Harford | |
Gordin Heywood | |
Graerdsen Heyward | |
Gordan Helmsward | |
Greg Heppleborn | |
Gertrude Himmelsbach | |
Goulash Halfwit | |
Homes Gobi | |
Gourdman Haybailer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment